artefactual / artefactual/atom
Problem: Multi-term search queries not tokenized into separate must clauses
- Dominant language
- PHP
- Stars
- 297
- Forks
- 152
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 3
Description
### Current Behavior
Search terms entered in the search box are searching as a quoted string. For example, searching for `term1 term2` with `default_operator: "AND"` results differ from `term1 AND term2`.
Searching for `term1 term2` seems to be treated as a single string in one must query clause (`term1 term2`).
### Expected Behavior
According to the [AtoM Docs](https://accesstomemory.org/en/docs/2.9/user-manual/access-content/search-atom/#the-atom-search-box-searchbox) : "Search terms entered in the search box are, by default, searched with an “AND” operator - that is to say, searching for kitty cat would by default search kitty AND cat."
Searching for `term1 AND term2` should be parsed into 2 separate must queries (first for `term1` and second for `term2`) to the BoolQuery, to match the behavior of an explicit `term1 AND term2` search.
### Possible Solution
Parse the search query by tokenizing on whitespace and add each term as a separate must clause to the BoolQuery.
### Context and Notes
Bug in ES 6+
### Version used
AtoM 2.9+
Contributor guide
Research direction
Start by reproducing the difference between `term1 term2` and `term1 AND term2` on the Elasticsearch 6+ search path, then locate where the BoolQuery is assembled. Done means whitespace-separated terms become separate must clauses and behave like the equivalent explicit AND query.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, php
- Domain
- backend, search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100