2

I am trying to write a lucene search in an Alfresco webscript (javascript) to find 1 of 2 custom types within a custom type cm:folder

So the folder might have the following contents 1. Some text (cm:content) 2. More text (custom:content) 3. Even more text (custom:content) 4. Another folder (cm:folder) 5. Crazy, more text (custom:content2) 6. Last text (custom:content2)

The expected result of the lucene search should return the following 2. More text (custom:content) 3. Even more text (custom:content) 5. Crazy, more text (custom:content2) 6. Last text (custom:content2)

Where am I going wrong with the lucene search? I have written something along the lines of

+PATH:"/app:company_home/PATH_TO_A_CUSTOM_TYPE_FOLDER/*" TYPE:"custom:content1"  TYPE:"custom:content2"

The problem is it returns all content, I think the intention is to write something like

+PATH:"/app:company_home/PATH_TO_A_CUSTOM_TYPE_FOLDER/*" +TYPE:"custom:content1" OR +PATH:"/app:company_home/PATH_TO_A_CUSTOM_TYPE_FOLDER/*"+TYPE:"custom:content2"

Worse case scenario is I can run 2 lucene searches, but it would be good to know how the query is written :-)

Thanks

Chris
  • 2,478
  • 3
  • 23
  • 38

1 Answers1

2

Can't you just do the following:

+PATH:"/app:company_home/PATH_TO_A_CUSTOM_TYPE_FOLDER/*" AND (TYPE:"custom:content1" TYPE:"custom:content2")

Because if you write +PATH TYPE: TYPE:, it actually says PATH:(Must have) OR TYPE: OR TYPE:, hence it looks that if the PATH: is matched it will return everything beneath.

Tahir Malik
  • 6,623
  • 15
  • 22
  • Can you give a concrete example I tried **+PATH:"/app:company_home/xy:folderABC/*" AND (TYPE:"xy:{http://www.companyXY.com/model/content/1.0}folder")**. In my case I've checked that in the content-model the xy:folder type is used. – sgirardin May 29 '17 at 14:16