Page MenuHomePhabricator

Add support for "phrase search" queries in MediaSearch profile
Closed, ResolvedPublic

Description

Searching for "exact phrases" should be supported in Media Search. The exact level of implementation of this can vary based on what's possible.

At the very least, we must not allow a multi-term (e.g. via AND/OR/NOT) query to entirely fall back to a non-MediaSearch query builder.
Even if we fail to fully handle (e.g. fetch relevant statements for) the phrase search part, the other part should still work as intended, while the phrase search is allowed to only do a full text search. We should also make sure that, in such case, the phrase query extends to the captions as well.

Ideally, if/once implementation allows for it, we also find statements for the phrase query, both when it's a standalone phrase query, or when used in combination with other terms (via AND/OR/NOT)

Acceptance criteria
REQUIRED:

IDEAL:

Event Timeline

Change 642013 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Implement support for phrase query nodes

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

Moving to "blocked" to allow search team time to look all of this over before we move forward.

Change 667993 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Add tests for MediaSearchOptions

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

Change 667993 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Add tests for MediaSearchOptions

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

Change 642013 merged by jenkins-bot:

[mediawiki/extensions/WikibaseMediaInfo@master] Implement support for phrase query nodes

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

Etonkovidova added a subscriber: Etonkovidova.

Checked in commons wmf.9. I did not mark all REQUIRED specs as Done - to see cirrusDumpQuery I needed to use e.g. https://commons.wikimedia.org/w/index.php?search=cat%20AND%20%22black%20dog%22&&title=Special:MediaSearch&go=Go&type=image&cirrusDumpQuery instead of the link mentioned in the task description.

Overall, the phrase search make sense:

  • if quotes are used, the phrase search returns smaller set of results
Search termsImageAudioVideoOther MediaCategories and Pages
Moebius surface710113018
"Moebius surface"170003
Prime Minister of India35,83055311,5653,894
"Prime Minister of India"1,29311638169

Searching just for Newtons cradle will include the files mentioned above.

  • Search for "San AND Francisco" did not return any results which seems as a reasonable result
matthiasmullie updated the task description. (Show Details)

The links in the description no longer worked because we had changed the query param from q to search. I've updated them to reflect the current reality.