[ https://issues.apache.org/jira/browse/JCR-989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509209 ]
Christoph Kiehl commented on JCR-989: ------------------------------------- To be honest I don't like this generic setOption() method. Methods like that tend to transport some configuration options that are not obvious to the user but I have to confess that ((LazyQueryResultImpl) result).setResultFetchSize(10) isn't that obvious either ;) If we provide such a setOption() method I would at least like to provide some constants like QueryImpl.setOption(LazyQueryResultImpl.RESULT_PREFETCH_SIZE, 123) which doesn't really make things better. I think the main problem is that resultPrefetchSize is not only lucene specific but also specific to LazyQueryResultImpl. I just got another idea. What do you think of some Timer that checks LazyScoreNodeIterator for activeness and closes the reader if there hasn't been any activity on the iterator for the last say 1 or 2 seconds? If the Iterator is used again the query can still be executed again and the current mechanism could be used. I think in most cases you iterate through the results quite quickly so the reader will only be closed when you are finished. This would eleminate the need to set resultPrefetchSize and would give better performance to most users without configuring anything while taking up a bit more resources. > Modify LazyQueryResultImpl to allow resultFetchSize to be set programmatically > ------------------------------------------------------------------------------ > > Key: JCR-989 > URL: https://issues.apache.org/jira/browse/JCR-989 > Project: Jackrabbit > Issue Type: New Feature > Components: query > Affects Versions: 1.3 > Reporter: Christoph Kiehl > Priority: Minor > Attachments: LazyQueryResultImpl.patch > > > In our application we have a search which only shows part of a query result. > We always know which part of the result needs to be shown. This means we know > in advance how many results need to be fetched. I would like to be able to > programmatically set resultFetchSize to minimize the number of loaded lucene > docs and therefore improve the performance. > I know it is already possible to the set the resultFetchSize via the index > configuration, but this number is fixed and doesn't work well in environments > where you use paging for your results because if you set this number too low > the query will be executed multiple times and if you set it too high too many > lucene docs are loaded. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.