[Enhance global search] Allow AND(&) operator in search text to pin point search result by multi term

Motivation:
The current global search is a very powerful and killer feature which enable universally searching the whole ERP system by simple key words, it is more a kind of internal Google. so far so good, per my observation and study the forum discussion about global search, I identified an important missing feature, that is it only support search by single key word or using as default an OR logic to combine all the user input search text separated by space. for example if we have similar items with names as
apple ipad, apple iphone, sumsung ipad, sumsung phone etc, there is no way to pin point the specific item, because using either single key word or multi key words separated by space will result more results than expected, the other similar cases is that some times it is needed to search orders by the item names included in it or by all the tags assigned to it, the current global search can not handle this important use case.
global_search_and
Solution
the user can use the AND operator (&) in the search text, e.g ‘apple & ipad’, then in the backend, two separate search into the global search help table will be executed, one for each search term, here apple and ipad respectively, then the 2 search results will be checked, only these records which exist in both search result (the AND logic) will be finally returned to the user(front end). it is quite straight forward. for more details, check the code.

here the pull request.
https://github.com/frappe/frappe/pull/5783
Any feedback and further comments?

Update 2020-05-15
the current ranking / relevancy handling mechanism in the global search function does not work for the above mentioned feature, instead the standard + can server the same purpose of & suggested above.

for example search apple and iphone like this apple +iphone, pay attention to the space before +.

5 Likes

Link to Pull Request/Code?

link attached,anyone can help to contribute the test?

Hi, have added some cues to add the test. Can you check if that helps?