[Xapian-discuss] writing match deciders / custom handling of terms

Oliver Flimm flimm at ub.uni-koeln.de
Tue Nov 11 07:11:17 GMT 2008


Hi,

On Mon, Nov 10, 2008 at 09:20:26PM +0200, djcb wrote:
> Now, it seems(?) that MatchDeciders are the way to go -- but I don't see
> a way to do the custom handling of the flags parameter -- am I missing
> something simple?

when using MatchDeciders I usually do it the following way to
implement facets in Perl:

1) For each facet I use a value to store the appropriate content of a
category (of our library catalogue). In case a document has multiple
content for a given facet (e.g. several subject headings in our
library catalogue) all fields get concatenated with \t. Another point
to be aware of: I couldn't get the query parser to search for 'terms
with spaces', although it's no problem to index them. Thats why I
replace them with underscores (and normalize special characters,
transform to lower case etc.) so 'Web 2.0' becomes 'web_2.0'. When
actually searching for a facet value you'll have to use the same
transformations.

2) To implement a match decider I use a hash (decider_map) for the
resulting facets and a code-ref $decider_ref where I place the code
for the decider. This code-ref is then used on the matches-Method of
the Enquery-Object:

my @matches   = $enq->matches(0,$maxmatch,$decider_ref);

I've written all this in my project wiki, *but* in german ;-)

http://wiki.openbib.org/index.php?title=Einführung_in_das_Xapian_Perl-API

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



More information about the Xapian-discuss mailing list