[Xapian-discuss] Saving multiple fields within one Xapian document

Ciaccio, Mauro Mauro.Ciaccio at ghxeurope.com
Mon Nov 11 18:07:30 GMT 2013


Hi,

I am experimenting with substituting a SQL Server Full Text Catalogue search with Xapian.

I am not sure what is the correct / best way to build the Xapian index. In my code I have tried two approaches

using (var db = SearchManager.OpenWriteDatabase())
using (var indexer = new TermGenerator())
using (var stemmer = new Stem("english"))
using (var doc = new Document())
{
    //doc.AddValue(0, item.RowID.ToString());
    //doc.AddValue(1, item.Description);
    //doc.AddValue(2, item.ItemCode);
    doc.SetData(string.Format("{0}_{1}_{2}", item.RowID.ToString(), item.Description, item.ItemCode));

    indexer.SetDocument(doc);
    indexer.SetStemmer(stemmer);
    indexer.IndexText(item.Description);
    indexer.IndexText(item.ItemCode);

    db.AddDocument(doc);
}

The SetData approach is the only one that I can get to work.

I'd appreciate any suggestions.

Thanks




CONFIDENTIALITY NOTICE - This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain information that is confidential. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that you must not read this transmission and that any disclosure, copying, printing, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify the sender by telephone or return e-mail and delete the original transmission and its attachments without reading or saving in any manner.


More information about the Xapian-discuss mailing list