Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-2439

IndexPlanner returning plan for queries involving jcr:score

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0.10, 1.1.6
    • lucene
    • None

    Description

      Consider a query like

      /jcr:root//element(*, cq:Taggable)[ (@cq:tags = 'geometrixx-outdoors:activity/biking' or @cq:tags = '/etc/tags/geometrixx-outdoors/activity/biking') ] order by @jcr:score descending
      
      

      And a seemingly non related index like

      /oak:index/assetType
        ...
        - type = "lucene"
        + indexRules
          + nt:base
            + properties
              + assetType
                - propertyIndex = true
                - name = "assetType"
      

      Then currently IndexPlanner would return a plan because even when it cannot evaluate any of property restrictions because it thinks it can sort on jcr:score. This later results in an exception like

      14.01.2015 16:16:35.866 *ERROR* [0:0:0:0:0:0:0:1 [1421248595863] POST /bin/tagcommand HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable
      java.lang.IllegalStateException: No query created for filter Filter(query=select [jcr:path], [jcr:score], * from [cq:Taggable] as a where [cq:tags] in('geometrixx-outdoors:activity/swimming', '/etc/tags/geometrixx-outdoors/activity/swimming') and isdescendantnode(a, '/') order by [jcr:score] desc /* xpath: /jcr:root//element(*, cq:Taggable)[ (@cq:tags = 'geometrixx-outdoors:activity/swimming' or @cq:tags = '/etc/tags/geometrixx-outdoors/activity/swimming') ] order by @jcr:score descending */, path=//*, property=[cq:tags=in(geometrixx-outdoors:activity/swimming, /etc/tags/geometrixx-outdoors/activity/swimming)])
      	at org.apache.jackrabbit.oak.plugins.index.lucene.LucenePropertyIndex.getQuery(LucenePropertyIndex.java:505)
      	at org.apache.jackrabbit.oak.plugins.index.lucene.LucenePropertyIndex.access$200(LucenePropertyIndex.java:158)
      	at org.apache.jackrabbit.oak.plugins.index.lucene.LucenePropertyIndex$1.loadDocs(LucenePropertyIndex.java:303)
      	at org.apache.jackrabbit.oak.plugins.index.lucene.LucenePropertyIndex$1.computeNext(LucenePropertyIndex.java:261)
      	at org.apache.jackrabbit.oak.plugins.index.lucene.LucenePropertyIndex$1.computeNext(LucenePropertyIndex.java:253)
      	at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
      

      Attachments

        Issue Links

          Activity

            People

              chetanm Chetan Mehrotra
              chetanm Chetan Mehrotra
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: