You are not logged in.

#1 2013-01-14 21:17:03

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 55
Website

Restrict language of Wiki search results?

Is there a way to restrict the results of the Wiki search to one (or several) languages?  I often get many results in languages I cannot read, sometimes ten or more translations of the same page.


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#2 2013-01-14 21:19:59

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,562
Website

Re: Restrict language of Wiki search results?

surfraw's archwiki elvis has a language switch to restrict results.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#3 2013-01-14 22:05:07

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 55
Website

Re: Restrict language of Wiki search results?

Thanks!  Very timely in more ways than one, as I have just installed surfraw today.

However... Surfraw does not get different results from the web interface for me.  It chooses a different server to query depending on the language option, but the wiki.archlinux.org server can return all kinds of languages other than English.  It will be helpful for a major non-English language, though.

I have read the wiki internationalisation thread since my first post (shame on me for not doing so earlier).  A post there suggests that searching the Wiki by language was considered impossible in late 2010.  Has this changed?

Possibly an English-only search would require all other languages being migrated to their own wikis.


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#4 2013-01-14 22:20:51

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,562
Website

Re: Restrict language of Wiki search results?

Yes, as far as I know, you can either search the language wikis for specific results, or use the main wiki and cope with everything.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#5 2013-01-15 09:12:42

kynikos
Wiki Admin
Registered: 2010-12-28
Posts: 157

Re: Restrict language of Wiki search results?

This thread looks very similar to https://bbs.archlinux.org/viewtopic.php?id=150476
Perhaps my post there may help you: https://bbs.archlinux.org/viewtopic.php … 2#p1174452

Offline

#6 2013-01-15 21:35:07

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 55
Website

Re: Restrict language of Wiki search results?

kynikos wrote:

This thread looks very similar to https://bbs.archlinux.org/viewtopic.php?id=150476

Yes, that is the same question.  I searched only the topics, not the full text, and included the keyword "language", so I missed it.  (Should have been more thorough.)

Thank you for pointing me to the MediaWiki API and the relevant Wiki pages.  I'll post again if/when I have scripted something more or less usable.

Regarding the discussion of Wiki internationalisation, it occurs to me that just including the (local) name of the language somwhere on each page would go a long way.  One could then get rid of most false positives by including the language as a search term (assuming the Wiki search, unlike web search engines, actually greps the documents).  Of course this is a bit of a hack.


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#7 2013-01-16 03:48:11

kynikos
Wiki Admin
Registered: 2010-12-28
Posts: 157

Re: Restrict language of Wiki search results?

deepsoul wrote:

Regarding the discussion of Wiki internationalisation, it occurs to me that just including the (local) name of the language somwhere on each page would go a long way.  One could then get rid of most false positives by including the language as a search term (assuming the Wiki search, unlike web search engines, actually greps the documents).  Of course this is a bit of a hack.

Maybe I haven't understood well what you mean, but the local name of the language is already included in all non-English article titles in the form "English_Title_(Language)", so restricting the search results to a non-English language is already as easy as including the language name in the search keywords; the only problem that we're having is when searching specifically for English articles with the wiki's interface (i.e. not through another client using API calls), and the two solutions proposed in https://wiki.archlinux.org/index.php/Help_talk:I18n are currently the only ones I'm aware of (adding an "_(English)" suffix to English articles won't be taken into consideration).

Offline

#8 2013-01-16 21:24:50

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 55
Website

Re: Restrict language of Wiki search results?

Yes, you are right.  I was thinking of including the language name somewhere on the page, but that amounts to the same thing.


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#9 2013-01-24 21:13:03

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 55
Website

Re: Restrict language of Wiki search results?

I have put together a Perl script that seems to work.  Download here.  It searches titles normally, unless you add a plus sign as the last argument.  (The API does not seem to support searching both titles and page text simultaneously.)  Adding more plus signs in the last argument retrieves more search results.  The number of results printed will vary depending on how many of the API results are English.  The metadata printed can be customised by modifying the @props array.

What I have not managed is to exclude redirect pages from the results.  This is supposed to work via the srredirect API parameter, but I have tried the values 0, off and false, without success.  What is the canonical boolean-false value of the MediaWiki API?


Officer, I had to drive home - I was way too drunk to teleport!

Offline

Board footer

Powered by FluxBB