Page MenuHomePhabricator

Insert Media only searches commons
Closed, InvalidPublic

Description

Author: robert.labrie

Description:
The VisualEditor insert media only searches commons. I have a media item called "WOM HighLevelDesign.png" but when searching for HighLevelDesign there are no results. Looking at the request in Firebug:

Request:
GET http://commons.wikimedia.org/w/api.php?callback=jQuery18305320913342615314_1392057641882&format=json&action=query&generator=search&gsrsearch=HighLevelDesign&gsrnamespace=6&gsrlimit=15&gsroffset=0&prop=imageinfo&iiprop=dimensions%7Curl&iiurlheight=150 HTTP/1.1
Host: commons.wikimedia.org
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://opsdocs.carnival.com/index.php?title=Main_Page&veaction=edit
Connection: keep-alive

Response:
HTTP/1.1 200 OK
Via: 1.1 varnish, 1.1 varnish, 1.1 CCLPRDINFTMG3
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Content-Length: 110
Age: 0
Date: Mon, 10 Feb 2014 19:33:02 GMT
Content-Type: text/javascript; charset=utf-8
Server: Apache
Accept-Ranges: bytes
X-Powered-By: PHP/5.3.10-1ubuntu3.9+wmf1
x-content-type-options: nosniff
Cache-Control: private
x-frame-options: SAMEORIGIN
Vary: Accept-Encoding,X-Forwarded-Proto
X-Vary-Options: Accept-Encoding;list-contains=gzip,X-Forwarded-Proto,Cookie;string-contains=commonswikiToken;string-contains=commonswikiLoggedOut;string-contains=forceHTTPS;string-contains=commonswikiSession;string-contains=centralauth_Token;string-contains=centralauth_Session;string-contains=centralauth_LoggedOut;string-contains=mf_useformat;string-contains=stopMobileRedirect
X-Varnish: 2999015801, 4264856558
X-Cache: cp1055 miss (0), cp1052 frontend miss (0)

jQuery18305320913342615314_1392057641882({"query":{"searchinfo":{"totalhits":0,"suggestion":"Hauserdesign"}}})


Version: unspecified
Severity: normal

Details

Reference
bz61151

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:57 AM
bzimport set Reference to bz61151.

robert.labrie wrote:

After cleaning my cache and setting $wgUseInstantCommons = false; the result is now as follows:

GET /api.php?format=json&action=query&meta=filerepoinfo HTTP/1.1
Host: opsdocs.carnival.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
X-Requested-With: XMLHttpRequest
Referer: http://opsdocs.carnival.com/index.php?title=Main_Page&veaction=edit
Cookie: wikidb796_session=86334fa21b8c09bd7c07958bdc0ac86e; wikidb796UserID=2; wikidb796UserName=CARNIVAL%5Crobertla; wikidb796Token=ceb473edd15eddf81147a6c9f583acf3; website#lang=en
Connection: keep-alive

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json; charset=utf-8
Vary: Accept-Encoding
Server: Microsoft-IIS/8.0
X-Powered-By: PHP/5.3.24
x-content-type-options: nosniff
x-frame-options: DENY
Persistent-Auth: true
Date: Mon, 10 Feb 2014 19:55:15 GMT
Content-Length: 198

{"query":{"repos":[{"name":"local","displayname":null,"rootUrl":"/images","local":true,"url":"/images","thumbUrl":"/images/thumb","initialCapital":true,"scriptDirUrl":"","scriptExtension":".php"}]}}

After a bit of testing and fiddling around, there seems to be an issue with the API call itself and its response.

The API returns a list of matches by complete words, and it seems that it considers the suffix as a word as well.

So, in my local wiki I have an image "image of space.jpg".

API calls:

&gsrsearch=space.jpg --> 1 match
&gsrsearch=space --> 0 matches
&gsrsearch=image --> 1 matches
&gsrsearch=from --> 0 matches
&gsrsearch=image+from --> 1 match
&gsrsearch=image+from+space --> 0 matches

I am not sure if this is because of the specific query we use to search images or if this is an artefact of the API itself.

I'm conducting further research.

Robert, if you have time to test this, try to see if you get the image you are looking for when typing "HighLevelDesign.png" or "WOM". Are you getting the local image on those searches?

I've CC'd Nik Everitt, our CirrusSearch guru, to see if he can provide any insight.

Can you also add a direct link to the image?

Marking as INVALID; this isn't a bug in VisualEditor, but an artefact of the (not very good) search system in MediaWiki (and a continuing issue even with CirrusSearch).