[Xapian-discuss] Re: getting search result data

Olly Betts olly at survex.com
Mon Jan 15 02:32:24 GMT 2007


> On 10/01/07, Jamie D <jam5t3r.lists at gmail.com> wrote:
> >From what I can see from the doc's, if I use scriptindex and I have 2
> >fields "id" and "quote" when I perform a search using the php bindings
> >the result of get_data() would be something like id=838 quote=a
> >quote....
> >
> >Is there any way to get xapian to return just a single field (id, or
> >quote) instead of all fields?

On Thu, Jan 11, 2007 at 11:30:58AM -0800, Jamie D wrote:
> I have worked this out. I needed to add the id as a value and retrieve
> it using get_value()

It's not really a good idea to abuse values as general purpose fields -
they're intended to provide fast access to small pieces of information
during the match itself, and the storage strategy used for them is
chosen with this use in mind.

Currently you need to pull out fields from the document data yourself
(or use Omega which has the $field{NAME} OmegaScript command, or take
the code from Omega if you're writing in C++).

This is another wheel which almost everyone ends up having to reinvent
so there ought to be a class (or something) to handle a standard scheme
for storing fields in the document data and retrieving them again.  The
wishlist item for this is bug#53:

http://www.xapian.org/cgi-bin/bugzilla/show_bug.cgi?id=53

Cheers,
    Olly



More information about the Xapian-discuss mailing list