lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Atul Bisaria <>
Subject Increase search performance
Date Tue, 30 Jan 2018 13:45:31 GMT
In the search use case in my application, I don't need to score query results since all results
are equal. Also query patterns are also more or less fixed.

Given these conditions, I am trying to increase search performance by

1.     Using ConstantScoreQuery so that scoring overhead is removed since scoring is not required
in my search use case. I also use a custom Sort object which does not sort by score (see code

Is this enough to remove scoring overhead in search?

2.     Using query cache

My understanding is that query cache would cache query results and hence lead to significant
increase in performance. Is this understanding correct?

I am using Lucene version 5.4.1 where query cache seems to be enabled by default (,
but I am not able to see any significant change in search performance.

Here is the code I am testing with:

DirectoryReader reader =;      //using MMapDirectory

IndexSearcher searcher = new IndexSearcher(reader);            //IndexReader and IndexSearcher
are created only once


//search code

QueryParser parser = new QueryParser("fieldname", analyzer);

Query query = new ConstantScoreQuery(parser.parse("text"));

ScoreDoc[] hits =, 20, sort).scoreDocs;

Given above conditions in my application, is there anything more I can do to get better search

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message