You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Thomas Mueller (Jira)" <ji...@apache.org> on 2021/01/06 08:41:00 UTC

[jira] [Updated] (OAK-9310) Wrong result in Join query with contains condition

     [ https://issues.apache.org/jira/browse/OAK-9310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Mueller updated OAK-9310:
--------------------------------
    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:

{noformat}
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}}
{noformat}

Converted solr query:
{noformat}
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:*+
{noformat}

  was:
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:*+}}


> Wrong result in Join query with contains condition
> --------------------------------------------------
>
>                 Key: OAK-9310
>                 URL: https://issues.apache.org/jira/browse/OAK-9310
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.32.0
>            Reporter: Mohammad
>            Priority: Major
>
> 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:
> {noformat}
> 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}}
> {noformat}
> Converted solr query:
> {noformat}
> 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:*+
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)