[Xapian-discuss] Am I looking in the right place

James Aylett james-xapian at tartarus.org
Tue Feb 8 17:18:39 GMT 2005


On Tue, Feb 08, 2005 at 04:46:52PM +0000, John Wards wrote:

> Can someone point me in the right direction (the right documentation as
> I can't spot it) on how to index a mysql database and also tell me if
> its possible to use xapian/omega to do the limiting of the data like I
> would with mysql AND statments.

I'm a little pressed for time right now, so I can't actually point you
in exactly the right direction (sorry :-), but yes you can do
this. What I suggest you do is to look at the omega documentation for
scriptindex, and then write a PHP CLI script that generates a
scriptindex data file from your mysql database (it'll take a while to
run, but will give you initial population of your database - once
you're up and running you can integrate live changes to the Xapian
database when you change the mysql db).

For the AND stuff, you'll want to generate 'boolean' terms in the
Xapian documents. I can't remember how good the documentation is at
pointing in the right direction here, but basically what you want to
do is define an all-capitals prefix such as XL for your location ids,
and then generate terms that might be XL1, XL27 for location id = 1, =
27 ... and so on.

Then, when searching using omega, you can add in B=XL1 or whatever and
the boolean terms (B for boolean) will be used to filter the documents
returned by Xapian (it's a little more complex than that, but it
should get you pointed in the right direction).

(The thing about indexing using Perl DBI refers to a script that will
do some of the above work for you, but I can't find it right
now. Hence the way I've suggested above, which will do what you want
without having to go near Perl :-)

J

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



More information about the Xapian-discuss mailing list