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

Thomas Mueller commented on OAK-34:
-----------------------------------

> Currently the query needs to be parsed twice.

A query only needs to be parsed twice if the method JCR API method 
Query.getBindVariableNames() is used. I guess normally this method isn't used, 
as the application already knows the bind variable names.

> The prepare() method would return a pre-parsed query

That's possible, but it would add another interface (Query) which isn't really 
necessary most of the time. Also, it wouldn't be necessary to avoid parsing 
queries twice (if this is what you are worried about). Instead of passing the 
parsed query to oak-jcr, the query engine in oak-core could keep a query cache. 
That would also speed up executing repeated queries.

> clients could build queries for their own languages

Currently, the query parsers are within oak-core. If additional query parsers 
are required, then I think oak-core is the place where they should be 
registered. I would like to avoid exposing the abstract syntax tree to oak-jcr.

> QueryResult which has an inner interface called Row

Sounds good to me, I will change it.

> Result.getRows() should probably return an Iterable

I also thought about that, but I would like to keep it until we have a good use 
case for Iterable.

> Maybe Result.getRows() should allow for specifying offset and limit.

Some optimizations might require to know the offset and limit before executing 
the query (the easiest optimization is using a limit of 0), therefore I would 
like to specify the offset and limit right when executing the query.

                
> Define query API
> ----------------
>
>                 Key: OAK-34
>                 URL: https://issues.apache.org/jira/browse/OAK-34
>             Project: Jackrabbit Oak
>          Issue Type: New Feature
>          Components: core
>            Reporter: Michael Dürig
>              Labels: query
>
> Define a oak-core API for handling queries. How do we handle name space 
> mappings, value bindings, limit, offset, access rights. See OAK-28

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to