Page MenuHomePhabricator

`x OR y` media searches return *all* documents
Closed, ResolvedPublic

Description

When searching for x OR y, all documents are returned, even if they match neither of the terms.
This is caused by a combination of the (default) addition of a keyword filter (filetype:bitmap|drawing) and the interpretation of AND/OR/NOT directives to must/should/must_not lucene clauses.

A x OR y query in the Media Search UI is turned into filetype:bitmap|drawing x OR y, which is interpreted as: MUST filetype:bitmap|drawing, SHOULD x, SHOULD y.
Therefor, everything that matches the filetype filter is valid, even if it doesn't match any of the should clauses. Those only contribute to the score, but are not required.

This should be fixed: keyword filters should further refine the resultset, not allow making it wider.

Event Timeline

Change 655894 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Move parsed query into separate must clause

https://gerrit.wikimedia.org/r/655894

Change 655894 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Move parsed query into separate must clause

https://gerrit.wikimedia.org/r/655894