Hi,

To find out what index was used, you should look at the query plan. You can get 
that if you execute "explain <query>". You can also get it if you enable debug 
level logging for "org.apache.jackrabbit.oak.query".

"No alternatives found" isn't a "complaint". It doesn't mean that your index 
wasn't used. What "No alternatives found" means is that no alternative way to 
run the query was detected.

Regards,
Thomas



On 23.01.18, 11:01, "techie2k" <[email protected]> wrote:

    Unable to create index::
    
    *No alternatives found. Query: select [rep:Authorizable].[rep:principalName]
    as [rep:Authorizable.rep:principalName],
    [rep:Authorizable].[rep:authorizableId] as
    [rep:Authorizable.rep:authorizableId], [rep:Authorizable].[jcr:uuid] as
    [rep:Authorizable.jcr:uuid], [rep:Authorizable].[jcr:primaryType] as
    [rep:Authorizable.jcr:primaryType], [rep:Authorizable].[jcr:created] as
    [rep:Authorizable.jcr:created], [rep:Authorizable].[jcr:createdBy] as
    [rep:Authorizable.jcr:createdBy] from [rep:Authorizable] as
    [rep:Authorizable] where [rep:Authorizable].[rep:principalName] =
    $principalName*
    
    And the equivalent index definition,
    /
      - compatVersion = 2
      - async = "async"
      - jcr:primaryType = oak:QueryIndexDefinition
      - type = "lucene"
      + indexRules 
       + rep:Authorizable 
        + properties 
         + principalName 
          - name = "rep:principalName"
          - propertyIndex = true/
    
    Oak API to create Index:
    
    *Node indexDef = JcrUtils.getOrCreateByPath("/oak:index/"+indexName,
    "oak:Unstructured","oak:QueryIndexDefinition", session,true);
    indexDef.setProperty("compatVersion", 2);
    indexDef.setProperty("type", "lucene");
    indexDef.setProperty("async", "async");
    
    Node indexRules = indexDef.addNode(LuceneIndexConstants.INDEX_RULES);
    Node authorizable = indexRules.addNode("rep:Authorizable");
    Node properties = authorizable.addNode("properties");
    Node principalName = properties.addNode("principalName");
    principalName.setProperty("name","rep:principalName");
    principalName.setProperty("propertyIndex",true);
    *
    
    
    Fails and every API call complaints on 'No alternatives found'
    
    Could someone help?
    
    <oak.version>1.5.18</oak.version>
    
    
    
    
    
    --
    Sent from: 
http://jackrabbit.510166.n4.nabble.com/Jackrabbit-Users-f510167.html
    

Reply via email to