librisxl
librisxl copied to clipboard
Feature/lws 66 bool filters
- Support aliased predefined filters that get special meaning in the query language, i.e. won't be interpreted as free text.
- Each filter is either active or inactive by default.
- The syntax for deactivating a filter in the query language is
NOT filterAlias
(e.g.NOT excludeEplikt
) and for activating it's simplyfilterAlias
. - If a user tries to deactivate a filter that is inactive by default by typing
NOT filterAlias
nothing will happen (that part will simply be excluded from the query string). Same thing if typingalias
when the filter is active by default. -
selectHeader
describes what happens when switching from the default mode (_selected: false
) to the non-default mode (_selected: true
) (not necessarily from inactive to active).
Some "side effects":
- Selected filters are detected during disambiguation so free text node merging had to be moved to after the disambiguation step.
- The redirection flow in
SearchUtils2.Query
has been simplified (see 9a83a6c). Before it was unnecessarily complex and based on a previous idea how the frontend would work. Now it's adjusted to how the frontend actually works. We can adjust as needed later should the frontend flow change. - As a consequence of the above point, https://github.com/libris/librisxl/pull/1436 is no longer relevant. A simpler solution to the unwanted asterisk in the input field is included in this PR instead, see 6d6ae1e.
TODO:
- Decide how to represent these filters in https://github.com/libris/definitions/blob/develop/source/apps.jsonld. The filter declarations are now hardcoded and incomplete, see https://github.com/libris/librisxl/blob/53fa0aab279a77caaa6f01083e33d8cfa824c69f/whelk-core/src/main/groovy/whelk/search/XLQLQuery.java#L664.
- Decide how selected filters should be reflected in
search.mapping
, i.e. modify this placeholder method https://github.com/libris/librisxl/blob/53fa0aab279a77caaa6f01083e33d8cfa824c69f/whelk-core/src/main/groovy/whelk/search/XLQLQuery.java#L344 - Frontend