0

I need to query a particular folder in the repository using a java based scheduler in alfresco.

I need to check whether the custom aspect's property is present or not.

Below query works for me when I don't use the path query.

select * from myType:caseDoc as d join myAspect:caseId as s on d.cmis:objectId = s.cmis:objectId

The problem with the above query is it searches all the contents in the repository but I want to target a particular folder.

When I try to put the CONTAINS in the above query it fails.

select * from cch:caseDoc as d
join cch:caseId as s on d.cmis:objectId = s.cmis:objectId WHERE CONTAINS('PATH:"//app:company_home/cm:FWED/cm:CDO/cm:CAB-DROP-FOLDER/*"')

It gives below exception A selector must be specified when there are two or more selectors

Thank you

Sam
  • 2,972
  • 6
  • 34
  • 62
  • 2
    It looks like you may be missing one argument in CONTAINS(). Did you try something like this? select * from cch:caseDoc as d join cch:caseId as s on d.cmis:objectId = s.cmis:objectId WHERE CONTAINS(d,'PATH:"//app:company_home/cm:FDLE/cm:CCH/cm:CCH-DROP-FOLDER/*"') – luiscolorado Mar 17 '17 at 19:13
  • why not getting folder with a java method since you are using CMIS – Yagami Light Mar 17 '17 at 19:24
  • If I get the folder by using java method then I need to get all its child and filter it by looping it. I think it will be very costly process in terms of memory and time. – Sam Mar 17 '17 at 19:57
  • @luiscolorado it worked well Thanks! I am just struggling with a small thing like a string value is black when I see from CMIS Workbench. but when I put condition at the end any of the below not working.. AND p.acc:cNumber <> '' gives Request failed 500 eroror 02170080 Request failed 500 /solr4/alfresco/cmis?wt=json&fl=DBID%2Cscore&rows=100&df=TEXT&start=0&locale=en&alternativeDic=DEFAULT_DICTIONARY&cmisVersion=CMIS_1_1&fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&fq=% AND p.acc:cNumber IS NOT NULL (return the row with blank cNumber) – Sam Mar 17 '17 at 20:21
  • Sam, I'd suggest putting that problem in a separate question. Is '' two apostrophes or a single quote? – luiscolorado Mar 21 '17 at 13:06
  • Yes, I did it. Thanks! http://stackoverflow.com/questions/42903935/alfresco-cmis-query-checking-for-null-blank?noredirect=1#comment72961263_42903935 – Sam Mar 21 '17 at 17:08

2 Answers2

1

It looks like you may be missing one argument in CONTAINS(). Did you try something like this?

select * 
  from cch:caseDoc as d 
    join cch:caseId as s 
    on d.cmis:objectId = s.cmis:objectId 
WHERE CONTAINS(d,'PATH:"//app:company_home/cm:FDLE/cm:CCH/cm:CCH-D‌​ROP-FOLDER/*"')

(I'm just putting my comment as an answer)

luiscolorado
  • 1,525
  • 2
  • 16
  • 23
0

Well, if you are worrying about the path, then you should put

CONTAINS('PATH:"/app:company_home/cm:FWED/cm:CDO/cm:CAB-DROP-FOLDER/*"')

With one single / at the start of the path, if you which to only search in direct children to that path or :

CONTAINS('PATH:"/app:company_home/cm:FWED/cm:CDO/cm:CAB-DROP-FOLDER//*"')

to perform the lookup in the whole underlying hierarchy!

However, I do think that the query you provided and the behaviour you described does not match each other !

Younes Regaieg
  • 4,156
  • 2
  • 21
  • 37