You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The approach used in publisherQuery() for building a phrase query
enforcing the specified prefix for all terms fails if the input phrase
contains a term that Xapian's query parser doesn't like (e.g. a
standalone ampersand character, 1/2, a#1, etc).
Using the quest tool (coming with xapian-tools under Ubuntu) the
issue can be demonstrated as follows:
$ quest -o phrase -d some_xapian_db "Energy & security act"
UnimplementedError: OP_NEAR and OP_PHRASE only currently support leaf subqueries
$ quest -o phrase -d some_xapian_db 'Energy 1/2 security act'
UnimplementedError: OP_NEAR and OP_PHRASE only currently support leaf subqueries
$ quest -o phrase -d some_xapian_db "Energy a#1 security act"
UnimplementedError: OP_NEAR and OP_PHRASE only currently support leaf subqueries
The problem comes from parsing the query with the default operation set
to OP_PHRASE (exemplified by the -o phrase option in above
invocations of quest). A workaround is to parse the phrase with a
default operation of OP_OR and then combine all the terms with OP_PHRASE.
This issue is likely to be present in libzim/src/search.cpp too, where set_default_op(Xapian::Query::op::OP_PHRASE) is used. It affects
suggestions in my local build of kiwix-serve (though the instance
running at library.kiwix.org seems to be unaffected, is it an old
version?).
The text was updated successfully, but these errors were encountered:
@kelson42 I don't see why you had to open this issue in libzim and then close it as a duplicate for #536. This bug was introduced and then fixed in the yet umerged PR kiwix/libkiwix#488. The only relation of that virtual issue to libzim is that an approach from libzim source code was utilized in new code added to kiwix-lib. The only thing that has to be done about that yet unmerged piece of code in kiwix-lib is to incorporate the extra fix (disabling of stemming) that @maneeshpm has done in #534.
The approach used in
publisherQuery()
for building a phrase queryenforcing the specified prefix for all terms fails if the input phrase
contains a term that Xapian's query parser doesn't like (e.g. a
standalone ampersand character, 1/2, a#1, etc).
Using the
quest
tool (coming with xapian-tools under Ubuntu) theissue can be demonstrated as follows:
The problem comes from parsing the query with the default operation set
to
OP_PHRASE
(exemplified by the-o phrase
option in aboveinvocations of
quest
). A workaround is to parse the phrase with adefault operation of
OP_OR
and then combine all the terms withOP_PHRASE
.This issue is likely to be present in libzim/src/search.cpp too, where
set_default_op(Xapian::Query::op::OP_PHRASE)
is used. It affectssuggestions in my local build of kiwix-serve (though the instance
running at library.kiwix.org seems to be unaffected, is it an old
version?).
The text was updated successfully, but these errors were encountered: