Page MenuHomePhabricator

[XL] Add support for boolean operators (AND, OR, -) to MediaSearch profile
Closed, ResolvedPublic

Description

Using CirrusSearch directly for MediaSearch instead of an API call (T252685) should give us search syntax support automatically (such as keywords/filters (ie gold intitle:gym), quotes, and booleans).

However, using those search syntax features currently will revert the results back to those in Special:Search, instead of MediaSearch.

This ticket is to support search syntax features in MediaSearch without reverting to Special:Search results. Here we should restore existing functionality so that boolean operators work on text results only, but ignore statements/entities. A new ticket will be created if we decide to expand booleans to work on statements/entities.


Notes from Matthias:

Negation etc. is becoming a lot more complex now that the data goes out to multiple sources.
So -dog no longer means that dog may not exist in the text. There may also not be any dog entity attached and it may not appear in caption.
Same with boolean operations. dog AND cat may be satisfied by cat being in wikitext and dog as depicts statement.
It's going to be a lot of work - if at all possible - to get it that complex.

Event Timeline

Blocked until parent task is completed.

Filters become available with T257304.
Other more complex syntax (boolean operations, negation, ...) will not yet work, though.

Putting into blocked until https://phabricator.wikimedia.org/T257304 is done, then we can consider the more complex syntax

matthiasmullie renamed this task from MediaSearch should support search syntax without reverting to Special:Search to Add support for boolean operators (AND, OR, -) and phrases to MediaSearch profile.Jul 15 2020, 2:34 PM
CBogen renamed this task from Add support for boolean operators (AND, OR, -) and phrases to MediaSearch profile to [XL] Add support for boolean operators (AND, OR, -) and phrases to MediaSearch profile.Jul 15 2020, 4:50 PM
CBogen updated the task description. (Show Details)

Change 632940 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] [WIP] Support boolean logic and phrases

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

Removing Search-Platform-Programs tag as its description says that it was "for FY 2017-2018".

Change 640809 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/CirrusSearch@master] Expose SearchQuery from SearchContext

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

Change 640819 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Split entity fetching out into its own class & allow multiple searches

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

Change 640820 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Support multi-term search queries

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

Change 640821 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Support phrases and other nonstandard input

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

Change 640924 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Refactor all query builders out into separate classes

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

Change 640924 abandoned by Matthias Mullie:
[mediawiki/extensions/WikibaseMediaInfo@master] Refactor all query builders out into separate classes

Reason:
This was rolled into the parent patch

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

Change 632940 abandoned by Matthias Mullie:
[mediawiki/extensions/WikibaseMediaInfo@master] [WIP] Support boolean logic and phrases

Reason:

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

Change 640809 merged by jenkins-bot:
[mediawiki/extensions/CirrusSearch@master] Expose SearchQuery from SearchContext

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

Change 641955 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Put keywords at the front of the querystring

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

matthiasmullie renamed this task from [XL] Add support for boolean operators (AND, OR, -) and phrases to MediaSearch profile to [XL] Add support for boolean operators (AND, OR, -) to MediaSearch profile.Nov 19 2020, 2:42 PM

This ticket is now solely about supporting logical operators (AND, OR, NOT), and being able to interpret the parts individually.
I've split up a lot of related work (support for several node types) into separate tickets & patches: T268235, T268236, T268237, T268238, T268239.

Change 640819 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Split entity fetching out into its own class & allow multiple searches

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

Change 641955 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Put keywords at the front of the querystring

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

Change 640820 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Support multi-term search queries

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

Change 640821 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Prepare for additional node handlers

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

Etonkovidova subscribed.

Checked in commons wmf.26 (the test cases are testing MediaSearch)