[Xapian-discuss] Matching substrings

James Aylett james-xapian at tartarus.org
Fri Apr 4 19:23:15 BST 2008


On Fri, Apr 04, 2008 at 07:27:57AM +0200, Lars Kruse wrote:

> please imagine the term "foobar" in a xapian database.
> I know, that it is possible to match this term with the following queries and
> flags:
> 1) "foo" (QueryParser.FLAG_PARTIAL)
> 2) "foo*" (QueryParser.FLAG_WILDCARD)
> 
> But I would like to construct a successful query like the following:
>  *bar
> 
> Is there any way of accomplishing this with xapian?
> As far as I understand the wildcard flag, it supports only right truncation (at
> the end of a string).

If you can suffer increasing the size of your database a fair bit, you
can store every term backwards as well (with a suitable prefix), so
that *bar becomes <prefix>rab*.

The way Xapian works is not generally suited to substring matching at
present.

J

-- 
/--------------------------------------------------------------------------\
  James Aylett                                                  xapian.org
  james at tartarus.org                               uncertaintydivision.org



More information about the Xapian-discuss mailing list