Lucene.Net - IndexWriter.SetMergedSegmentWarmer [closed]

你离开我真会死。 提交于 2019-12-23 07:00:31

问题


Anyone have an example of how to use IndexWriter.SetMergedSegmentWarmer in Lucene.Net?

When I try something like...

IndexWriter.IndexReaderWarmer warmer = new IndexWriter.IndexReaderWarmer();
indexWriter.SetMergedSegmentWarmer(warmer);

I get

Cannot create an instance of the abstract class or interface 'Lucene.Net.Index.IndexWriter.IndexReaderWarmer'


回答1:


Well, you should write your own. IndexWriter.IndexReaderWarmer is abstract class, so it doesn't provide warm up implementation. The purpose of this class is to define contract between IndexReader and IndexReaderWarmer so they can communicate appropriately.

Writing your own implementation is not easy task. You should decide how exactly you will warm the reader up. Several ideas:

  • perform recently executed queries over new reader;
  • perform static bunch of queries;
  • perform FieldCache preload only.


来源:https://stackoverflow.com/questions/12271614/lucene-net-indexwriter-setmergedsegmentwarmer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!