[Xapian-discuss] Xapian's definition of a field
James Aylett
james-xapian at tartarus.org
Thu Nov 6 17:42:13 GMT 2008
On Thu, Nov 06, 2008 at 05:43:15PM +0200, Henry wrote:
> I'm coming from another indexing system/paradigm which uses named
> "fields" which store strings which are subsequently searched on
> thusly: title:internet
>
> The only reference to "fields" I can find in the Xapian API docs is
> add_prefix("field", "P"), etc, but this seems to be unrelated.
It's related to what you want to do, but Xapian doesn't call this
'fields'. We talk about 'term prefixes', which in the add_prefix
example above is 'P' (this is how it's stored in the database), which
are mapped to user-friendly names ('field') so you can search for
'field:contents'.
So, for instance, if you used the prefix 'S' for subject/title (which
is the standard we use in Omega, for instance) then
add_prefix("title", "S") would allow users to search for
"title:internet".
If you're using scriptindex, it'll add term prefixes for you if you
tell it to. Doing it by hand is a bit more work, but entirely
possible.
> Lastly, what is add_value(valueno, strvalue) for? :-)) I can't
> figure it out.
Two things: most commonly (at least at the moment) for collapsing
documents (so you only get one out of a set with the same thing for a
given value number; you can also use them in sophisticated features
like MatchSpy.
J
--
/--------------------------------------------------------------------------\
James Aylett xapian.org
james at tartarus.org uncertaintydivision.org
More information about the Xapian-discuss
mailing list