Greets, It's been a long day, and my brain is becoming mushy, so forgive my silly questions: 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. I understand the use of add_posting() calls (which seems to be "anonymous" in the sense that you only specify the term itself, not a label/name) to build a document which is then indexed, etc. However, how do you define named "fields" in a document which can be used in searches such as site:www.abc.com? Lastly, what is add_value(valueno, strvalue) for? :-)) I can't figure it out. set_data() I get - I can stuff some useful variables therein for special use, but add_value() with a value number? Is it also simply to store values in for special use? Does it influence indexing/searching somehow? Thanks! Henry
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
Henry wrote on 11/6/08 9:43 AM:> Greets, > > It's been a long day, and my brain is becoming mushy, so forgive my > silly questions: > > I'm coming from another indexing system/paradigm which uses named > "fields" which store strings which are subsequently searched on > thusly: title:internetHi Henry, You might want to check out this old thread, in which I asked similar questions when I was starting with Xapian. http://thread.gmane.org/gmane.comp.search.xapian.general/2024 -- Peter Karman . http://peknet.com/ . peter at peknet.com