[Xapian-discuss] Xapian-discuss Digest, Vol 88, Issue 9

James Aylett james-xapian at tartarus.org
Wed Sep 21 15:00:38 BST 2011


On 21 Sep 2011, at 12:24, Sam Millman wrote:

> I am still trying to cover add_value some more though since I seem to not
> understand it totally.

Values are used for a few specific things; it sounds like you need it for sorting and probably range searches, in which case you need to turn your data (timestamp in this case) into an appropriate string before putting it in a value. See <http://xapian.org/docs/valueranges.html#datevaluerangeprocessor>, for instance. For sorting by value, see <http://xapian.org/docs/sorting.html#sorting-by-value>.

> Faceting section is great that shows examples and everything and quite a few
> other sections are good but I am kinda stuck when it comes to actually
> indexing and defining types

Xapian doesn't have types. You turn your document into terms (plus document data for display purposes, and values for sorting and collapsing); terms can be generated by TermGenerator (word splitting and stemming), or by other means. (TermGenerator is designed to work with QueryParser so you don't have to construct Query objects by hand at the other end.)

The overview <http://xapian.org/docs/overview.html> covers this, although it's easy to dismiss it from the opening section I suspect :-(

> Like in the official documentation it would be awesome if indexing and
> adding documents sections would give you examples on indexing in the native
> C++ and explaining how the different indexing method works

An example indexer is covered in the quickstart doc: <http://xapian.org/docs/quickstart.html>. Note that values aren't mentioned in quickstart, because you don't need them to get going (indeed, you can often build entire systems without them, although not if you're working with dates that people need to be able to sort or filter on).

> and what
> add_value is and how it all kinda binds together with slotno and that and
> just in general how Xapian indexing, add of documents, add of values, the
> actual methods and all that works.
> 
> I see a lot of documentation based around the methods but none on the
> methods themselves.

I'm not sure I understand what you mean; the methods are documented, usually in reasonable detail, in the API docs. Here's the documentation for Xapian::Document::add_value <http://xapian.org/docs/apidoc/html/classXapian_1_1Document.html#12857fccd3448ec1db91311c16d67f6c>:


void Xapian::Document::add_value (
	Xapian::valueno 	slot,
	const std::string & 	value	 
)

Add a new value.

The new value will replace any existing value with the same number (or if the new value is empty, it will remove any existing value with the same number).



> If I am being blind with the docs do correct me :)


One of the problems we have is it's not always obvious where to look in the docs to find things out. If there are places that would obviously benefit from cross links, or entire new documents that you feel should exist, you can put a note in <http://trac.xapian.org/wiki/MissingDocumentation>, or mention it on the list.

J

-- 
 James Aylett
 talktorex.co.uk - xapian.org - devfort.com




More information about the Xapian-discuss mailing list