Hi, While working with Searcher.Search, I have noticed a difference in their performance. I have 10 lakh documents and 30 fields in my index. I have performed three searches using different queries in a sequential manner. At search time, I used MMapDirectory and index is opened.
*case1: * - During the first search, I ran the Query Say (new TermQuery(new Term("name","Chitra"))) and which yields 1 lakh documents as result. Time taken for first search = 50 - 60 ms nearly. - And for the second search, I ran the Query Say (new TermQuery(new Term("animal","lion"))) which also yields 1 lakh documents as result. Time taken for Second search = 50 - 60 ms nearly. - And for the third search, I ran the Query Say (new TermQuery(new Term("bird","peacock"))) which also yields 1 lakh documents as result. Time taken for Third search = 50 - 60 ms nearly. In this case, why does searcher.search take the same search time for different queries? *case2:* Suppose if I ran the same query twice, Searcher.search took less time than the previous search because of os cache. *Based on above observation, * During initial search, only the required portion of index files will be loaded to i/o cache. And for the next search, if the required portion is not present in os cache, Will it take time to read that files from disk? If so, this is the reason behind searcher.search is taking the nearly same search time for different queries. Regards, Chitra