Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top