[Xapian-discuss] some problems and prefixes

Olly Betts olly at survex.com
Sat Jun 20 14:00:30 BST 2009


On Sat, Jun 20, 2009 at 09:55:43AM +0200, Rafi wrote:
> OB> Sounds very odd, but I've no idea what's going on.  I think you'll need
> OB> to show us a self-contained example which demonstrates this behaviour.
> 
> ok, this is how Im doing (this is only a general example for testing
> purposes):
> 
>     $database = new XapianWritableDatabase(XAPIAN_DB_FILE, Xapian::DB_CREATE_OR_OPEN);
>     $o_Magazyn->getProductForIndexer($database);
> //    $database->flush();
>     $database = null;
> 
> and function  getProductForIndexer looks like:
> [...]

This isn't a self-contained example though - I can't run it without
adding in missing code (e.g. setting XAPIAN_DB_FILE) and setting up a
SQL database containing data unknown to me.

I don't see any obvious problem with the code, so I really need
something I can run which makes your problem happen in front of me.
Then I can debug it rather than only being able to guess what is
happening.

> OB> Yes, though for a filter term like this add_boolean_prefix() makes more
> OB> sense than add_prefix() - the latter is for "free text" prefixes.
> 
> Do you mean, that add_prefix() I should use for example II in my
> previous post and add_boolean prefix for example I?

Well, not really.  A shop id is naturally a filter, unless you have
something very different in mind to what I have - you want to restrict a
free text search for a product using a boolean filter on a shop id.  In
example II you're indexing the shop id as free text, which doesn't
make much sense.  For example, you don't want to word split or stem it.
If you had a web form interface, you'd probably consider a drop down
list of shop ids (unless you have a lot of them).

You'd use add_prefix() to allow searching within the document title, for
example.  You want to be able to search for words with the title.  You
wouldn't provide a drop down list of the titles of all documents in the
database.

Cheers,
    Olly



More information about the Xapian-discuss mailing list