wiki:FAQ/TermGenerator

How does TermGenerator differ from add_posting() and add_term()?

TermGenerator is a class which will parse a piece of text supplied to it, splitting it up into individual words, and applying the appropriate stemming operations. It will generate terms which are compatible with those produced by the QueryParser class.

Document::add_posting() and Document::add_term() add a single term to a document. The term is added to the document exactly as supplied to the functions; no stemming is performed, and the term is not split into separate terms for each word. These functions are actually called by TermGenerator to add the terms it generates to the document.

Typically, TermGenerator should be used if you have a piece of text to index, and you want to be able to generate queries to search that text using the QueryParser class. add_term() or add_posting() should be used if you have specific terms to add (either because you are implementing your own term generation strategy, or because you are storing extra information in the database, for example, to implement some boolean filters).

FAQ Index

Last modified 10 years ago Last modified on 21/10/08 08:51:05