[Xapian-discuss] QueryParser, mapping a single prefix to multiple fields ?

Olly Betts olly at survex.com
Thu Sep 14 16:48:45 BST 2006


On Wed, Sep 13, 2006 at 12:34:51PM +0200, Daniel M?nard wrote:
> From what I see, this is not something which is currently supported. If 
> I call multiple times add_boolean_prefix with the same 'field', only the 
> first prefix is taken into account.

That's a bug - calling add_boolean_prefix() a second time should change
the prefix.  But I failed to remember how std::map::insert() works in this
case (we've had a previous bug because of this too sadly - I think I
need to go and audit all calls to std::map::insert()).

> Perhaps it would be a useful feature to add to the query parser? It 
> would not break the API (just call add_prefix / add_boolean_prefix 
> several times with the same field and different prefixes) and I don't 
> think it would break any existing code.

It shouldn't break existing code (since add_prefix and add_boolean_prefix
currently don't work as intended when called a second time) but it would
make it impossible to change the registered prefixes, and having to
start from a fresh QueryParser is a pain if you just want to change one
setting.

But it's not an unreasonable thing to want to do, and I think it should
be possible to allow it.  I'm in the middle of trying to sort out UTF-8 
right now - can you file a wishlist bug so this doesn't get forgotten?

Cheers,
    Olly



More information about the Xapian-discuss mailing list