[GeoNode-users] GET /h_keywords_api does not return the keywords

Chiara Sammarco chiara.sammarco at geodatalab.it
Mon Dec 9 02:11:35 PST 2019


Thanks for your reply, Paolo.
Since I didn't want the admin to be in charge of this, I've written some
code for
fixing at least partially the bug by myself.
I'm in a rush for a deadline, but I would like to finish something in the
code and then if it can be interesting for the others, I can share my code.

basically the hkeyword (or something like that) function in the views was
calling the wrong model.
Indeed there are two tables in the db: one containing the  hkeyword
details and the other containing
the information "which resource is associated to which keyword" - the last
one is the most interesting
for the inquiry. Because from there I could:

- get the count (how many times each keyword is contained in each resource
of a specific type)
- if count = 0 I don't pass the keyword

I've also pass the resource type (in order to filter only the keyword
associated to a particular type of resource - layer, map or document)

I've just to fix the view for showing the bullet (since I have not found
this last step immediate, I left for a second moment).
but it is still much better now. In my case, I don't have structured
keyword, all of my keywords are leaves in the tree of keywords, so
for making the code still more general, this case should be treated.

Thanks for your help and answer.
Have a nice day,
Chiara

On Thu, Dec 5, 2019 at 3:52 AM Paolo Corti <pcorti at gmail.com> wrote:

> Hi Chiara
> you are correct. The old feature of taggit with the elements counting
> has been lost when the hkeyword app replace taggit app in GeoNode (I
> believe at
> 2.4) and all of the keywords are now displayed even if there are not
> elements referring to.
> For one of the GeoNode instances I am in charge of - where the number
> of keywords was becoming really too large, I created a small app which
> let the GeoNode admin to select which keywords to show in the left
> side search menu.
> That is in a private git repo but if there is interest I can port it
> to GeoNode core. Though, no countings.
> Paolo
>
> On Wed, Dec 4, 2019 at 3:48 AM Chiara Sammarco
>
> <chiara.sammarco at geodatalab.it> wrote:
> >
> >
> >
> > Hi again,
> > I just wanted to tell that I've found the new tables where the keywords
> are stored: base_hierarchicalkeyword and base_taggedcontentitem
> > Once I repopulated those tables, the keywords appeared in the list.
> >
> > Now the problems are the following:
> > - the keywords are shown only with the folder icons (even id there are
> no children under them)
> > - the number of elements (layers or map) associated to a specific
> keyword is not shown
> > - in the list (both in Maps and in Layers) all the keywords are shown
> (also if there are no elements for that keyword).
> >
> > Are these issues? Or am I supposed to do something else?
> > Thanks in advance for your help,
> > Chiara
> >
> > On Mon, Dec 2, 2019 at 5:23 PM Chiara Sammarco <
> chiara.sammarco at geodatalab.it> wrote:
> >>
> >> Hi all,
> >>
> >> My environment: SPCGeonode 2.0, Ubuntu 18.04
> >>
> >> Problem: geonode does not fetch from the database neither the keywords
> associated to the layers, nor those associated to the maps. So basically
> the following requests both return an empty array:
> >>
> >> GET /h_keywords_api?type=layer
> >> GET /h_keywords_api?type=map
> >>
> >> I've checked in the database and the keywords are presents in the
> taggit_tag and taggit_taggeditem tables.
> >> Do you have any suggestions what it could be and how I could fix this?
> >> Thanks in advance for your help,
> >>
> >> Chiara
> >>
> >>
> >>
> >
> > _______________________________________________
> > geonode-users mailing list
> > geonode-users at lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/geonode-users
>
>
>
> --
> Paolo Corti
> Geospatial software developer
> web: http://www.paolocorti.net
> twitter: @capooti
> skype: capooti
> #drt3jc1
>


-- 
Chiara Sammarco
Full Stack Developer
[image: GeoDataLab] <https://www.geodatalab.info/>
via Vanni Biringucci, 55/B| Roma, RM 00156
tel (+39) 0647543579 | mobile (+39) 3421960662
www.geodatalab.info | management at geodatalab.it
[image: LinkedIn] <https://linkedin.com/in/chiarasammarco/> [image: Twitter]
<https://twitter.com/geodatalab> [image: Facebook]
<https://it-it.facebook.com/geodatalab/>
*Nota di riservatezza: *Questa email contiene informazioni private e/o
confidenziali. Se hai ricevuto questo messaggio per errore sei pregato di
eliminarlo e notificare il mittente. Grazie per la collaborazione.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20191209/ab7382b2/attachment-0001.html>


More information about the geonode-users mailing list