Optimizing Lucene performance

前端 未结 6 808
耶瑟儿~
耶瑟儿~ 2020-12-07 21:21

What are the various ways of optimizing Lucene performance?

Shall I use caching API to store my lucene search query so that I save on the overhead of building the qu

相关标签:
6条回答
  • 2020-12-07 21:42

    Have you looked at

    Lucene Optimization Tip: Reuse Searcher

    Advanced Text Indexing with Lucene

    Should an index be optimised after incremental indexes in Lucene?

    0 讨论(0)
  • 2020-12-07 21:42

    Quick tips:

    • Keep the size of the index small. Eliminate norms, Term vectors when not needed. Set Store flag for a field only if it a must.
    • Obvious, but oft-repeated mistake. Create only one instance of Searcher and reuse.
    • Keep in the index on fast disks. RAM, if you are paranoid.
    0 讨论(0)
  • 2020-12-07 21:44

    For 64 bit machines use MMapDirectory instead of RAMDirectory as very well explained here by one of the core Lucene committers.

    0 讨论(0)
  • 2020-12-07 21:54

    Cheat. Use RAMDirectory to load the entire index into the ram. Afterwards, everything is blazing fast. :)

    0 讨论(0)
  • 2020-12-07 21:54

    I have found that the best answer to a performance question is to profile it. Guidelines are great, but there is so many variables that can impact performance such as the size of your dataset, the types of queries you are doing, datatypes, etc.

    Get the Netbeans profiler or something similar and try it out different ways. Use the articles linked to by Mitch, but make sure you actually test what helps and what (often surprisingly) hurts.

    There is also a good chance that any performance differences you can get from Lucene will be minor compared to performance improvements in your code. The profiler will point that out as well.

    0 讨论(0)
  • 2020-12-07 21:56

    Lots of dead links in here.

    These (somewhat official) resources are where I would start:

    http://wiki.apache.org/lucene-java/ImproveIndexingSpeed

    http://wiki.apache.org/lucene-java/ImproveSearchingSpeed

    0 讨论(0)
提交回复
热议问题