[ 
https://issues.apache.org/jira/browse/JCR-2959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084206#comment-13084206
 ] 

Jukka Zitting commented on JCR-2959:
------------------------------------

Just measuring the Query.execute() time doesn't give you very meaningful 
results. You'll need to include the time it takes to iterate through the 
returned nodes, as that's the time that an end user would be seeing.

I'd expect the Collections.sort() overhead to be a problem only for big query 
results of which the client only traverses a small subset of first results 
(i.e. the typical Google search result use case). For such cases it would 
indeed be great if the SQL2 engine could leverage the result ordering features 
of the underlying Lucene index.

As for the implementation, I'd rethink the rather complicated 
DynamicOperandFieldComparator mechanism that can make the Lucene index call 
back through layers of abstraction with Session.getNodeByIdentifier(). Instead 
we could simply divide the given Orderings to those that the Lucene index can 
take care of and those that need to be applied with the current 
Collections.sort() implementation. Any Lucene-compatible Orderings at the 
beginning of the list would be converted and passed to Lucene, and the 
remaining Orderings (if any) would be handled with the current mechanism.

> SQL2 QueryEngine should use Lucene for sort
> -------------------------------------------
>
>                 Key: JCR-2959
>                 URL: https://issues.apache.org/jira/browse/JCR-2959
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-core
>    Affects Versions: 2.2.1
>            Reporter: Robert Seidel
>            Priority: Minor
>         Attachments: JCR-2959.patch
>
>
> Currently all SQL2 queries with "order by" expression are sorted with 
> Collections.sort - which is slow and very bad if there are lots of hits. 
> Lucene should be used for sorting hits instead.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to