Open TkTech opened 6 years ago
Very cool!
Is there an open PR for this?
This and all the associated tickets (default field values, group descriptions, hidden fields on resources, etc...) are all part of an ongoing contract. Unfortunately at the moment the main requirement is "finish it yesterday" so these changes are not of reasonable quality, or are very specific to the current contract. I hope to have something merge worthy shortly after the contract is over.
Great thanks for that @TkTech - happy to help test once you have something in play.
Would love to take this feature for a spin. Any update @TkTech ?
ping @TkTech just checking in on this... happy to help tidy up code if it's in a "bit of a state" to get this out in the wild for reuse...
@TkTech any update on this?
I'm currently not receiving any funding so it's at the bottom of the priority list. There's an old, simple version of this that's part of the ckanext-dfo extension that could very easily be ripped out. It has some quirks; The date pair is hard-coded, and select boxes need to be modified before they're rendered to always have a blank default value otherwise you can't exclude them from being searched.
https://github.com/tk-technologies/ckanext-dfo/blob/master/ckanext/dfo/plugins.py#L202 https://github.com/tk-technologies/ckanext-dfo/blob/master/ckanext/dfo/templates/advanced_search.html https://github.com/tk-technologies/ckanext-dfo/tree/master/ckanext/dfo/fanstatic
This feature adds a new optional field-level flag,
make_searchable: True
. When this field exists on at least one field an advanced search page will be created. Currently it adds a link under the search bar:This page will render all fields in the schema marked
make_searchable
, re-using the existing form snippets to render them.If a date pair exists (
start_date
andend_date
by default), a date range selector will be rendered instead using bootstraprap-daterangepicker (with small fixes to make it compatible with all versions of CKAN bootstrap and icons):Hitting search generates a query and redirects to the normal search page. If you got to the advanced search page from a type-specific page (ex: /my-schema) it'll redirect there. Since this tool is just a query builder, normal search plugins, sort, faceting etc all work as expected.
The one gotcha is that date fields need to end in
_date
when using the default CKAN solr schema, since this will cause them to index as TrieDateField.