[MNT-14368] CLONE - Using disjunction "OR" in CMIS query returns wrong number of results when SOLR 4 is used Created: 10-Jul-15  Updated: 17-Jul-15  Resolved: 17-Jul-15

Status: Closed
Project: Service Packs and Hot Fixes
Component/s: Search and Indexing (non-UI)
Affects Version/s: 5.0.0.3
Fix Version/s: None

Type: Hot Fix Request
Reporter: John-Taylor Smith [X] (Inactive) Assignee: Closed Issues
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Alfresco 5.0.0.5, 5.0.1, 5.0.2 - solr4
opencmis-workbench-0.12.0-full


Attachments: JPEG File 01_cmisadminlogin.jpg     JPEG File 02_AminQueryBeforePermissionChange.jpg     JPEG File 03_ChangePermission_text1.jpg     JPEG File 04_ChangePermission_text2.jpg     JPEG File 05_AminQueryAfterPermissionChange.jpg     JPEG File 06_user1QueryAfterPermissionChange.jpg    
Issue Links:
Cloners
is clone of MNT-13767 Using disjunction "OR" in CMIS query ... Closed
Dependency
Duplicate
is duplicated by MNT-14003 SOLR4 duplicating results when changi... Closed
Bug Priority:
Category 3
ACT Numbers:

00439664


 Description   

Using disjunction "OR" in CMIS query returns wrong number of results when SOLR 4 is used.

Environment:
Alfresco 5.0.0.5, 5.0.1, 5.0.2 (checked with both solr1 and solr4).
For CMIS query 'opencmis-workbench-0.12.0-full' has been used.

Steps to reproduce:
1- In Alfresco Share invite a user to a site (e.g. "user1" with "Consumer" role)

2 - In document library of a site create two items of content: "test1.txt" and "test2.txt"

3- In workbench the following cmis query returns two results for both "user1" and "admin":
SELECT * FROM cmis:document WHERE cmis:name like '%test1%' or cmis:name like '%test2%' order by cmis:name

4- Disable inheritance for both "test1.txt" and "test2.txt" and add "user1" to have permission on "test1.txt" (e.g. "Site Consumer")

5- Run the same cmis query again with admin user:
SELECT * FROM cmis:document WHERE cmis:name like '%test1%' or cmis:name like '%test2%' order by cmis:name

Expected behaviour:
The query returns 2 records: one record for test1.txt and one for test2.txt

Observed behaviour:
The query returns 4 records: two records for test1.txt and two records for test2.txt. (duplicates the result)

6- Run this query with "user1" user:
SELECT * FROM cmis:document WHERE cmis:name like '%test1%' or cmis:name like '%test2%' order by cmis:name

Expected behaviour:
The query returns 1 records: test1.txt that this user has permission on that.

Observed behaviour:
It displays "runtime: Unauthorized" error message.

Analysis to date:

  • If "OR" disjunction is removed in the query, it displays correct number of results:
    SELECT * FROM cmis:document WHERE cmis:name like '%test1%'
    This returns one result with admin user and one result with user "user1"

SELECT * FROM cmis:document WHERE cmis:name like '%test2%'
This returns one result with admin user and no result with user "user1"

  • Reverting the permission to the default value doesn't fix the issue. Query still displays 4 records for admin.
  • This issue is NOT reproducible in Solr 1.
  • Log messages after enabling the following debugs:
    log4j.logger.org.alfresco.solr.query.AbstractQParser=DEBUG
    log4j.logger.org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient=debug
Logging

DEBUG [org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient] [http-apr-8080-exec-3] Sent :/solr4/alfresco/cmis?wt=json&fl=DBID%2Cscore&rows=100&df=TEXT&start=0&locale=en_AU&alternativeDic=DEFAULT_DICTIONARY&cmisVersion=CMIS_1_0&fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON

DEBUG [org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient] [http-apr-8080-exec-3] with:

Unknown macro: {"queryConsistency"}

DEBUG [org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient] [http-apr-8080-exec-3] Got: 4 in 892 ms



 Comments   
Comment by Jennie Soria [X] (Inactive) [ 17-Jul-15 ]

Fix is supplied in the v5.0.2 service pack line, workaround in interim is to run with SOLR1 instead of SOLR4 until updated to the newer Service Pack 5.0.2+ line(s) is done.

Generated at Fri Apr 23 11:27:04 BST 2021 using Jira 7.13.15#713015-sha1:7c5ddd2c3e1709974ae9c48c17df8edd3919fe2c.