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

Wrong result in Join query with contains condition

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.32.0, 1.36.0
    • None
    • query
    • None

    Description

      I have problem with join query and contains condition. The condition is on join query but when query converted to solr query, the condtion applied on main type. When I change contains to equal the query convert and execute correctly.

      After debugging I found this query has two execution plan. when The query engine select below plan it does not have any result but when use other plan it has result. This problem caused random result in search feature.

       

      SQL2 query:

      SELECT san_sinaBaseDossier.* 
      FROM [san:lkeBaseDossier] AS san_lkeBaseDossier 
      INNER JOIN [san:lkeBaseDocument] as san_lkeBaseDossier_san_documents 
      ON san_lkeBaseDossier_san_documents.[jcr:uuid] = san_lkeBaseDossier.[san:documents] 
      WHERE ((CONTAINS([san_lkeBaseDossier_san_documents].[san:docDesc], cast('*123*' AS string)))) 
      AND ISDESCENDANTNODE(san_lkeBaseDossier, '/contents/dossiers') 
      ORDER BY [san_lkeBaseDossier].[jcr:createdBy] DESC}}
      

      Converted solr query:

      q.op=AND
      &fl=path_exact+score
      &df=catch_all
      &rows=10
      &sort=jcr\:createdBy_string_sort+desc
      &fq=(jcr\:primaryType:san\:lkeBaseDossier+)+
      &fq=path_des:\/contents\/dossiers&fq=\{!collapse+field%3Dpath_collapsed+min%3Dpath_depth+hint%3Dtop_fc+nullPolicy%3Dexpand}
      &q=*123*+san\:documents:*+
      

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            Mahdavi Mohammad Mahdavi

            Dates

              Created:
              Updated:

              Slack

                Issue deployment