30 Aug 11:29
Re: using xapian for indexing mails
From: Matthew Somerville <matthew <at> mysociety.org>
Subject: Re: using xapian for indexing mails
Newsgroups: gmane.comp.search.xapian.general
Date: 2008-08-30 09:29:27 GMT
Subject: Re: using xapian for indexing mails
Newsgroups: gmane.comp.search.xapian.general
Date: 2008-08-30 09:29:27 GMT
djcb wrote: > Or is there some easier way to simply provide blobs of text, and being > able to search for them later? You want XapianTermGenerator, which takes a blob of text and adds all the words in it to Xapian. e.g. (snippet of the written-in-PHP http://sandwich.ukcod.org.uk/~matthew/subtitles/?source=1#indexer ): $indexer = new XapianTermGenerator(); $indexer->set_flags(128); $indexer->set_database($db); # For spelling [... then for each document ... ] $doc = new XapianDocument(); $indexer->set_document($doc); $doc->set_data( [...] ); $doc->add_term( [...] ); $doc->add_value( [...] ); $indexer->index_text($text); $db->add_document($doc); ATB, Matthew
RSS Feed