[Xapian-discuss] omega and searching specific fields

Olly Betts olly at survex.com
Mon Mar 7 15:32:00 GMT 2005


On Sun, Mar 06, 2005 at 09:12:36PM -0500, Sig Lange wrote:
> I am indexing a music collection and want to be able to perform
> searches in certain fields.  I'm a little confused on the difference
> between "boolean filters" and "Probabilistic Fields" .. I am using
> boolean filters but perhaps use the other? I would like to use the B=
> CGI parameter to search in omega.

To put it simply:

If you want to perform a free-text search on a field (which will
generally contain multiple words of text), you want "probabilistic".

If the field contains a single category or code or similar, and you
want to be able to filter search results according to the value of
this field, you want to index it as "boolean".

> So, I came up with a index file like this:
> -- begin music.index --
> id: index boolean=Q unique=Q

You don't want index here - that will index the id as a probabilistic
term.  So unless you want someone to be able to type
"39c5236d30e6c24cb737f3d166a7e05a" into your search box, the "index"
isn't useful.

So you want:

id: boolean=Q unique=Q

> artist: lower field=artist boolean=XART index

You probably want to preserve the case of the artist in the field,
so put lower *after* field=artist.  I'm not sure if you really want
to lower for probabilistic indexing anyway...

And I suspect artist should be a probablistic field.  In which case you
want:

artist: field=artist index=XART

If you really want a boolean filter, then probably:

artist: field=artist lower boolean=XART

> path: field=url

OK.

> info: lower index

Probably just:

info: index

And I'd imagine you'd also want to index album and title (which are in
the sample record you gave).

> I can search and retrieve these documents as correctly but when I pass
> a B=XART for example, I don't seem to be getting the normal results
> back.

If XART is boolean, you need to specify a whole term, not just a prefix
- for example: 'B=XARTa perfect circle'.

If you're hoping to generate a drop-down list of artists, you'll need
to tweak Omega.  There's a commented out function in query.cc called
'do_picker' which is probably close to what's needed.  We wanted to
make it possible to generate these using omegascript, but that's not
been done yet.

Cheers,
    Olly



More information about the Xapian-discuss mailing list