LUCENE's first application

xiaoxiao2021-03-06  41

I used Lucene to get the first aggregation attempt and set its optimized timid and method through app.config files:

IF (deleditemids == null) deleditemids = new queue (config.rsndexminmerge);

// deleditemids is used to save the DocumentId that needs to be updated

DeletedItemids.enqueue (item.Id);

THIS.RSSINDEXWRITER.ADDDocument (item.getdocument ()); // Indexwriter.

Int doccount = rsSindexwriter.doccount ();

IF (DOCCOUNT% config.rssindexminmergedocs == 0) // Optimize every config.rssindexminmergedocs

{

While (deletedItemids.count> 0)

{// Process for updates

String id = deletedItemids.dequeue () as string;

RSSIndexReader.delete (New Lucene.Net.index.Term (IndexedFeedItem.fn_ItemID, ID));

}

RsSindexReader.close (); // Turn RSSIndexReader.

RsSindexwriter.optimize (); // Perform optimization

Rssindexreader = indexreader.open (config.rsSindexpath); // Reopen RSSIndexReader.

}

转载请注明原文地址:https://www.9cbs.com/read-66994.html

New Post(0)