Hi David, 

Thanks for raising that issue. 

The API call for the search suggestions was basically copied from that of the mobile web search

https://en.wikipedia.org/w/api.php?
action=query&
format=json&
generator=prefixsearch&
prop=pageprops%7Cpageprops%7Cpageimages%7Cpageterms&
redirects=&
list=prefixsearch&
ppprop=displaytitle&
piprop=thumbnail&
pithumbsize=80&
pilimit=15&
wbptterms=description&
gpssearch=cake&
gpsnamespace=0&
gpslimit=15&
pssearch=cake&
pslimit=15

But your right, for our purposed the 'list' is unnecessary and can be omitting, like below: 

https://en.wikipedia.org/w/api.php?
action=query&
format=json&
generator=prefixsearch&
prop=pageprops%7Cpageprops%7Cpageimages%7Cpageterms&
redirects=&
ppprop=displaytitle&
piprop=thumbnail&
pithumbsize=80&
pilimit=15&
wbptterms=description&
gpssearch=cake&
gpsnamespace=0&
gpslimit=15&

I've created a phab ticket for this issue, it will be resolved shortly :) 
https://phabricator.wikimedia.org/T129639

Thanks, 
- Jan

On Fri, Mar 11, 2016 at 11:41 AM, David Causse <dcausse@wikimedia.org> wrote:
Hi,

first of all: congrats for this new search box!

I noticed that you use action=query with both generator=prefixsearch and list=prefixsearch.
IIRC when we looked at this (it was when we looked at the way some API consumers generates their requests) we noticed that it generates 2 prefixsearch queries on the backend. I think this adds unnecessary latency.

Unfortunately I don't know why you need to use list and generator at the same time, is this a limitation of the API?
If we can't fix the API call could we work on a cache at the backend level to avoid 2 elasticsearch queries?

Thanks!

_______________________________________________
discovery mailing list
discovery@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/discovery