Page MenuHomePhabricator

Exact search does not work with the API
Closed, InvalidPublic

Description

Try searching for the word "kíváló" (a misspelling of "kiváló") on Hungarian Wikipedia: http://hu.wikipedia.org/wiki/Speci%C3%A1lis:Keres%C3%A9s/k%C3%ADv%C3%A1l%C3%B3
You get thousands of hits, because the search algorithm does not differentiate between the two words.

Now try the same search, but put double quotes around the word: http://hu.wikipedia.org/wiki/Speci%C3%A1lis:Keres%C3%A9s/%22k%C3%ADv%C3%A1l%C3%B3%22
This will return exact matches only (and thus it is a good way to find typos).

The same does not work with the API: http://hu.wikipedia.org/w/api.php?action=query&list=search&srsearch=k%C3%ADv%C3%A1l%C3%B3&srwhat=text has similar results as the normal search for the same string (though the number of results is slightly different), but http://hu.wikipedia.org/w/api.php?action=query&list=search&srsearch=%22k%C3%ADv%C3%A1l%C3%B3%22&srwhat=text returns no results.


Version: 1.16.x
Severity: normal

Details

Reference
bz21081

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:53 PM
bzimport set Reference to bz21081.

Also, searching for a double quote character and nothing else gives a "text search disabled" error: http://hu.wikipedia.org/w/api.php?action=query&list=search&srsearch=%22&srwhat=text

rainman wrote:

You cannot search for the double-quote character, and the queries you give seem fine to me. Please check user preferences for your user and bot to verify you are searching the same namespaces..

User preferences should not influence API results, and even if they did, that would not explain differences between API and normal search. Anyway, the queries work fine now, so whatever caused the bug must have been fixed in the meanwhile.

(In reply to comment #3)

User preferences should not influence API results

They should, and they do so consistently. People have actually /requested/ that bots' preferences be taken into account for certain actions (most notably preferences such as "watch all pages I edit" or "mark all my edits as minor")

Well they certainly do not do so consistently. When I click on the normal search link, I get 25 results - 2 in article namespace, the rest in project. When I click on the API search link, I only get the two mainspace hits. Both searches use the same keyword and no other parameters.

(In reply to comment #5)

Well they certainly do not do so consistently. When I click on the normal
search link, I get 25 results - 2 in article namespace, the rest in project.
When I click on the API search link, I only get the two mainspace hits. Both
searches use the same keyword and no other parameters.

I guess you're right, for searches this is not true: srnamespace defaults to 0.