1 Hi, by default xapian/omega use locate param from blog.setup to set stemmer language when wiki is indexing.
3 But, when you search, we use omega cgi, and we not set language, so if you indexing in french, but search in english, you have a bad result.
5 I propose to set a new param omega_stemmer in blog.setup, to fix the same language when we indexing, and searching. And if omega_stemmer is not set, we use LANG env param.
7 Bellow, you can find the patch.
11 diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm
12 index 42d2e0d..08a0a01 100644
13 --- a/IkiWiki/Plugin/search.pm
14 +++ b/IkiWiki/Plugin/search.pm
15 @@ -33,6 +33,13 @@ sub getsetup () {
16 safe => 0, # external program
22 + description => "language used for indexing and searching",
23 + safe => 0, # external program
29 @@ -136,7 +143,7 @@ sub indexhtml (@) {
30 # Index document and add terms for other metadata.
31 my $tg = Search::Xapian::TermGenerator->new();
33 - my $langcode=$ENV{LANG} || "en";
34 + my $langcode=$config{omega_stemmer} || $ENV{LANG} || "en";
37 # This whitelist is here to work around a xapian bug (#486138)
38 @@ -183,6 +190,18 @@ sub cgi ($) {
40 $ENV{HELPLINK}=htmllink("", "", "ikiwiki/searching",
41 noimageinline => 1, linktext => "Help");
42 + my $langcode=$config{omega_stemmer} || $ENV{LANG} || "en";
45 + # This whitelist is here to work around a xapian bug (#486138)
46 + my @whitelist=qw{da de en es fi fr hu it no pt ru ro sv tr};
48 + if (grep { $_ eq $langcode } @whitelist) {
49 + $ENV{STEMMER}=$langcode;
54 exec($config{omega_cgi}) || error("$config{omega_cgi} failed: $!");
57 diff --git a/templates/searchquery.tmpl b/templates/searchquery.tmpl
58 index 15bc78e..4742460 100644
59 --- a/templates/searchquery.tmpl
60 +++ b/templates/searchquery.tmpl
62 $setmap{prefix,title,S}
63 $setmap{prefix,link,XLINK}
64 -$set{thousand,$.}$set{decimal,.}$setmap{BN,,Any Country,uk,England,fr,France}
65 +$set{thousand,$.}$set{decimal,.}$setmap{BN,,Any Country,uk,England,fr,France}$set{stemmer,$env{STEMMER}}
68 $if{$ne{$topdoc,0},<INPUT TYPE=image NAME="<" ALT="<"