Oliver Flimm
2013-Jul-05 14:27 UTC
[Xapian-discuss] Indexing, searching and sorting signed integers
Hi, for a project we need to index, search and sort by negative integers (years b.c.) in Xapian. Is this possible? I already tried to index the negative integers including a search prefix with add_term. I have theses terms in my index X7-58 X7-59 X7-60 But the query parser seems to ignores the dash when searching: 2013/07/05 15:57:53 DEBUG> Xapian.pm:812 OpenBib::Search::Backend::Xapian::parse_query - Xapian-Querystring: year:-59 - Xapian-Filterstring: 2013/07/05 15:57:53 DEBUG> Xapian.pm:292 OpenBib::Search::Backend::Xapian::search - Internal Xapian Query: Xapian::Query(X759:(pos=1)) I got the Internal Xapian Query with $enq->get_query()->get_description(); For the actual enquiry I used my $enq = $dbh->enquire($self->{qp}->parse_query($fullquerystring,FLAG_WILDCARD|FLAG_BOOLEAN|FLAG_PHRASE)); with year:-59 as $fullquerystring and X7 as the search prefix for year. I would have expected X7-59 for the internal query term... And of course I only got results for a positive term 59 ;-) Regards, Oliver -- Universitaet zu Koeln :: Universitaets- und Stadtbibliothek IT-Dienste :: Abteilung Universitaetsgesamtkatalog Universitaetsstr. 33 :: D-50931 Koeln Tel.: +49 221 470-3330 :: Fax: +49 221 470-5166 flimm at ub.uni-koeln.de :: www.ub.uni-koeln.de
Olly Betts
2013-Jul-05 23:03 UTC
[Xapian-discuss] Indexing, searching and sorting signed integers
On Fri, Jul 05, 2013 at 04:27:43PM +0200, Oliver Flimm wrote:> with year:-59 as $fullquerystring and X7 as the search prefix for year. > > I would have expected X7-59 for the internal query term... And of > course I only got results for a positive term 59 ;-)It works if you set year as a boolean prefix, which is what you almost certainly want to do anyway: $ examples/quest -byear:X7 "rome year:-59" Parsed Query: Query((Zrome at 1 FILTER X7-59)) Cheers, Olly