Why does full-text search inside titles return error
Asked Answered
L

2

9

When I perform full-text search with Wikipedia API, I can not narrow it to titles only (srwhat=title).

So while search anywhere (default) http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=sql&srnamespace=14&format=xml

returns results, if I add srwhat=title, I got an error:

<api servedby="mw69">
  <error code="srsearch-title-disabled" info="title search is disabled"/>
</api>

This error is even listed in the docs ( http://www.mediawiki.org/wiki/API:Search ), but without any explanation.

Lampley answered 15/1, 2013 at 11:58 Comment(2)
It seems there is a way to workaround this. See this answer: #27624931Cassaba
opensearch is a good alternativeSobriquet
C
3

It means that the search engine Wikipedia uses (Lucene, I believe) does not support title search.

Constanceconstancia answered 15/1, 2013 at 15:3 Comment(3)
You mean, there are features planned in the API that could not be supported due to particular engine used?Lampley
MediaWiki is not just Wikipedia. Other wikis don't use Lucene, so they can support title search. But Wikipedia doesn't.Constanceconstancia
Thanks, looking at the searching help, I also found that I can use the same operators in the search (so "intitle:" should help) so no problem with not supporting titles directlyLampley
C
7

Actually, there is a way to workaround this, just add intitle: prefix to your search term:

srsearch=intitle:sql

You can find an explanation here: https://en.wikipedia.org/wiki/Help:Searching#Parameters

Cassaba answered 22/10, 2015 at 13:6 Comment(0)
C
3

It means that the search engine Wikipedia uses (Lucene, I believe) does not support title search.

Constanceconstancia answered 15/1, 2013 at 15:3 Comment(3)
You mean, there are features planned in the API that could not be supported due to particular engine used?Lampley
MediaWiki is not just Wikipedia. Other wikis don't use Lucene, so they can support title search. But Wikipedia doesn't.Constanceconstancia
Thanks, looking at the searching help, I also found that I can use the same operators in the search (so "intitle:" should help) so no problem with not supporting titles directlyLampley

© 2022 - 2024 — McMap. All rights reserved.