ckan / ckan/ckanext-scheming

Support for automatic "Advanced Search" forms.

Open
#178 8 comments 8 reactions 1 assignee Claimed by @TkTech View on GitHub
enhancement WIP
Dominant language
Python
Stars
102
Forks
182
PR merge metrics
No merged PRs in 30d

Description

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:

![image](https://user-images.githubusercontent.com/72590/38715679-9426799e-3eaa-11e8-8bda-6e1ad5155392.png)

This page will render all fields in the schema marked `make_searchable`, re-using the existing form snippets to render them.

![image](https://user-images.githubusercontent.com/72590/38715725-d6d0b3d6-3eaa-11e8-8d0d-75c6faf9c005.png)

If a date pair exists (`start_date` and `end_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):

![image](https://user-images.githubusercontent.com/72590/38715744-ecbc24dc-3eaa-11e8-82ae-3ba5e3242db7.png)

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.

![image](https://user-images.githubusercontent.com/72590/38715773-299d2824-3eab-11e8-94e4-e68474412d62.png)

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.