Should advanced search use OR as default operator instead of AND
NOTE: Currently turned off behind a feature flag
Problem
Today our Advanced Search is defaulting our search queries to using "AND" as the default operator as part of the query syntax https://docs.gitlab.com/ee/user/search/advanced_search_syntax.html#using-the-advanced-syntax-search
This means that when you search for (for example) the keywords analyze storage used elasticsearch you will only find results that include all of the keywords. In Elasticsearch simple query string syntax this is mapped automatically to analyze & storage & used & elasticsearch.
This is useful when you are thinking of search like a filter. But when you're trying to discover an issue and you maybe have gotten one of the keywords wrong (eg. it was meant to be "analysis" instead of "analyze") then you won't find the issue at all and without knowing which keyword is wrong you have nowhere to go.
Solution
If you think about search as a way to discover and not necessarily like a filter then maybe it is more valuable to use "OR" as the default operator. In the above example you may want the default to be analyze | storage | used | elasticsearch. In this case it reveals the actual issue I was searching for at the top which actually contained the word "analysis" (which I confused for "analyze").
In that case even if one of your words is wrong you will still get some results back and if the ranking is good you will likely see the result you were looking for at the top of the list assuming some of the keywords are relevant.
This is an easy settings change in our Elasticsearch query to change the default operator.
Switching to OR by default optimizes for discovery while possibly leading to frustration about too many irrelevant results. A user can always explicitly specify the &, however, if they do want to filter down very deliberately. It's also easy for the user to see after their first search that they need to be more specific, if they get back too many results. We could even add a hint to use & syntax if we return (for example) > 100 results.
It's also easy in our code to change the default depending on the type of resource you are searching for. It may make sense for AND to be the default for code (computer readable text => more structured) search but OR should be the default for issues, comments, merge requests (human readable text => less structured).
This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.