[Xapian-discuss] Indexing and searching on a custom data type

Olly Betts olly at survex.com
Wed Jul 8 15:49:06 BST 2009


On Wed, Jul 08, 2009 at 04:24:02PM +0200, Thomas Chambon wrote:
> >Alternatively, you can indeed implement this in code. For sorting,
> >look at Xapian::Sorter, and for matching look at Xapian::MatchDecider
> 
> The problem is that my custom data type is not a string, or a date or an
> integer. It is more like a series of intervals (An interval is
> represented by two dates). With postgresql I have created a custom data
> type to stock a vector of intervals. But this type doesn't exist in
> xapian, so it can't be indexed. 

Well, you need to work out *how* to represent this with what Xapian
provides.

It sounds to me like you can serialise this data into a single string,
and then store that in a document value slot at index time.

Then at search time you can use a MatchDecider which can fetch the
serialised string, unpack it to get the candidate document's fuzzy date,
and check if it matches whatever criteria you want to impose.

> Is it possible to index a vector of dates as a term ? If it is possible,
> it should be possible to implement customs  Xapian::Sorter and
> Xapian::MatchDecider to manage a request on that term.

Xapian::Sorter requires you to build a string sort key.  That should be
possible for any total ordering relation, but I'm unclear how to decide
if one series of date intervals is "greater than" another so it's a bit
hard to suggest anything...

Cheers,
    Olly



More information about the Xapian-discuss mailing list