[Xapian-discuss] More than one Index?

James Aylett james-xapian at tartarus.org
Mon Jan 30 12:58:10 GMT 2006


On Mon, Jan 30, 2006 at 11:47:43AM +0000, John Wards wrote:

> Is it possible to have more than one index but select what the bindings
> search on?
>
> So at the moment I index property addresses, I would also like to index
> property descriptions for more advanced searching but only as an
> optional extra...probably in an extra search box.

One way of doing this is to prefix all terms generated from the
property descriptions, and then append the prefix to all terms out of
that extra search box. So you might choose XDESC or something. There
should be some info on how to do this in the scriptindex
documentation, although it may not be as clear as it could be.

> Also I would like to analyse the property descriptions to see what the
> most popular descriptive words that Estate Agents use, I have had a look
> at the API and can't spot anything. I see I can get the number of
> occurences of a term but I would have to come up the the terms
> myself..which I suppose I could do but I would rather it was the other
> way.

You can get an iterator to all terms in the database using
Xapian::Database::allterms_begin() (db.allterms_begin() in
Python). The TermIterator that returns *may* be able to give you a
frequency in the database via its get_termfreq() method, but I don't
know if that actually works for the all terms iterator. If not, you
can use the iterator to get the terms, and use
Xapian::Database::get_collection_freq() to get the frequency.

J

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



More information about the Xapian-discuss mailing list