-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
@nigelbabu I didn't know where to put this
This is looking good, really good start. Some comments (I know some are copied from pages, I don't like them there either :) )
- Let's drop the
ckanext_suffix on action / auth functions names - No need to import and add the model and user here,
get_actionwill add them automatically if you pass an empty dict as context. - I think actions should not
abortthings, as they might be called eg via the command line. Just let the exception propagate and it will be catch by the controllers, helpers, etc. - I will probably use
after_search, as this will ensure we record what was actually requested to Solr, and extensions can modify the params before. - I'd rename the
contentfield toparamsand store the wholesearch_paramsdict, otherwise storing justqis a bit limited. Examples,- We might want to check what sorting does people use
- Check popular facets
- Store bounding boxes for spatial queries
- We need to decide what we consider a "user search". As it is now, the extension will log any call to
package_search, including any loading of the home page, dataset page, org page, etc. At the first stage, we probably only want to record them when the user enters something on the search box (both on dataset page and the site wide on the navbar). Also when clicking on facets on the search page. The only way I can think right now of doing this is doing these checks:
if (tk.c
and tk.c.user
and tk.c.controller == 'package'
and tk.c.action == 'search'
and (
(q is not None and not q in ('', '*:*'))
or fq != '+dataset_type:dataset')
): This still misses stuff like spatial queries, but we can polish it later
- Let's put a hard limit on
_listjust in case.
Next step is start thinking in how to make this accessible to extensions. I'm thinking a h.get_search_history(user_id) helper function which just returns a list of search_params, and maybe another one that formats the output nicely, eg:
{"q": "rabbits", "fq": "topic-category:environment"}
to
Search Term: "rabbits", Filters: "topic-category:environment"
or similar
What do you think?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels