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

Chetan Mehrotra commented on OAK-7256:
--------------------------------------

[~edivad] The issue you are referring to is OAK-3606

> Query: option to wait for indexes to be updated
> -----------------------------------------------
>
>                 Key: OAK-7256
>                 URL: https://issues.apache.org/jira/browse/OAK-7256
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: query
>            Reporter: Thomas Mueller
>            Priority: Minor
>             Fix For: 1.10
>
>
> Sometimes (rarely, but still) queries should include the very latest changes, 
> even if the index is updated asynchronously. For example when running unit 
> test: data is added, and then a query is run to check if the data is there. 
> The problem with asynchronous indexes is, you don't know exactly how long you 
> have to wait. Often the index is updated quickly, and sometimes it takes a 
> few seconds.
> What about extending the query syntax as follows:
> Wait for all indexes (no matter which index is used for this query) - this 
> would be used rarely, just for testing:
> {noformat}
> /jcr:root/* 
> option(wait for all indexes timeout 60)
> {noformat}
> Wait for just those indexes (well, usually it's just one, but sometimes it's 
> multiple) that are needed for the given query. This query could also be used 
> in an application that strictly needs the very latest results, even for 
> fulltext queries. The "timeout" would mean "wait at most 10 seconds, and if 
> not up-to-date then throw an exeption", while "max 10" would mean "wait at 
> most 10 seconds, but still run the query in any case".
> {noformat}
> /jcr:root/content//*[jcr:contains(., 'hello')] 
> option(wait for indexes max 10)
> {noformat}
> The query would wait, and once the indexes are up-to-date, return the 
> requested result.
> So the syntax is (both SQL-2 and XPath):
> {noformat}
> <query> option(wait for [all] indexes 
>   { max | timeout } <numberOfSeconds> 
>   [, <otherOptions> ] )
> {noformat}
> So other options can also be used (option traversal fail,...).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to