Hi, I have a Lucene index with 70,000 documents. The size of the index is round 300MB - I have 32 fields, but I only retrieve values for 11 fields when I display results on the page (I use FieldSelector). The query time is great - most of the queries execute under 50ms, however when I loop through results to retrieve documents (I only retrieve 10 documents at once, because this is my pagination size), the loop takes sometimes even longer than 300ms
I applied all recommendations mentioned on that page http://wiki.apache.org/lucene-java/ImproveSearchingSpeed to optimize query time. I was really surprised when I noticed that the bottleneck is in the loop below, especially becuase the index is not that big (only 300MB) and the hits array contains only 10 elements Is there anything else I can do to optimize document retrieval from lucene index? Here is the sample code: Dim FastFieldSelector As New FastFieldSelector(Fields) For i As Integer = 0 To hits.Length - 1 Dim DocId As Integer = hits(i).DocId * Dim doc As Document = reader.Document(DocId, FastFieldSelector) ' this line is taking long time* For Each f As Field In Fields ... Dim values() As Fieldable = doc.GetFieldables(f.Name) .... Next Next Thanks, Andrew