[Xapian-discuss] Spaces in bool prefixes

James Aylett james-xapian at tartarus.org
Thu Feb 21 11:56:02 GMT 2008


On Wed, Feb 20, 2008 at 07:15:50PM -0800, Rick Olson wrote:

> For instance, I have:
> 	add_boolean_prefix('X_Country:', 'country');
> which works until you come across a country with more than one word, 
> such as United States.

In many situations, your boolean terms are going to come from a fixed
or bounded vocabulary. Certainly in the case of modern countries you
could replace at index time (and hence also at query time) with the
appropriate ISO two- or three-letter code, avoiding the need for
spaces.

It's worth noting that (a) spaces generally are going to delimit
terms, and (b) you don't want to use phrase searching unless you need
to, because it needs to consider more in order to work. Since you
almost always have to construct prefixed terms in boolean context,
doing a little bit more work to construct them in a way that avoids
spaces isn't generally a problem.

If it is in your case, you may need to do some more work somewhere
else. I'm assuming you don't actually expect your end users to type
"country:united states" into a search box somewhere (although maybe
I'm wrong), so it should be possible to come up with a solution
without too much effort.

J

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



More information about the Xapian-discuss mailing list