Here is a proof of concept for replacing current use of full text queries (with query_string) by boolean queries on biblio searches. Advantage: => No search craches with special character ( "!", ")" etc...) => Separate query context and filter context: - Search scores are not altered by facets, - Ability to use range filter (i.e for publication date facet) Also, this POC adds a button "ES query" in the search results header so you can see the query sent to ES. Code is not beautiful, there is no unit test, it's a POC.
Created attachment 98242 [details] [review] Bug 24555: Replace query string with boolean query Test plan: Just make simple and advanced searches
Created attachment 98243 [details] [review] Bug 24555: add a button that shows ES query in search result
Created attachment 98247 [details] [review] Bug 24555: Replace query string with boolean query Test plan: Just make simple and advanced searches Signed-off-by: Michal Denar <black23@gmail.com>
Created attachment 98248 [details] [review] Bug 24555: add a button that shows ES query in search result Signed-off-by: Michal Denar <black23@gmail.com>
Created attachment 104419 [details] [review] Bug 24555: Use 'cross_fields' type for multi_match queries It allows to search in all fields as if it were one big field. It also uses 'and' as operator, which means that all searched terms must appear at least in one field for a document to match https://www.elastic.co/guide/en/elasticsearch/reference/6.8/query-dsl-multi-match-query.html#type-cross-fields
Created attachment 104422 [details] [review] Bug 24555: Use 'cross_fields' type for multi_match queries It allows to search in all fields as if it were one big field. It also uses 'and' as operator, which means that all searched terms must appear at least in one field for a document to match https://www.elastic.co/guide/en/elasticsearch/reference/6.8/query-dsl-multi-match-query.html#type-cross-fields
Created attachment 105061 [details] [review] Bug 24555: Remove 'mc-' prefix in facet field name
Created attachment 105470 [details] [review] Bug 24555: Use operator "and" for match query
Created attachment 105471 [details] [review] Bug 24555: Fix search limits
Created attachment 105472 [details] [review] Bug 24555: Fix search limits
Created attachment 105744 [details] [review] Bug 24555: Fix searches like 'field-name:term' This is used for instance in Koha::Authorities::get_usage_count ("an:<authid>")
So sad :/ Applying: Bug 24555: Replace query string with boolean query Using index info to reconstruct a base tree... M Koha/SearchEngine/Elasticsearch/QueryBuilder.pm Falling back to patching base and 3-way merge... Auto-merging Koha/SearchEngine/Elasticsearch/QueryBuilder.pm CONFLICT (content): Merge conflict in Koha/SearchEngine/Elasticsearch/QueryBuilder.pm error: Failed to merge in the changes.
What is the status of this?