I'd like to search for nodes that do not have a specific property from the Javascript Console using fts-alfresco. Is this possible? I've tried several variations such as ISNULL, ISUNSET.
In the following example, I'm trying to find nodes that do not have the custom property gry:documentNumber.
var searchObj = {
query: 'PATH:"/app:company_home/st:sites/cm:test-area/cm:documentLibrary/cm:Test//*" AND TYPE:"gry:content" AND ISNULL:"gry:documentNumber" AND -ASPECT:"rma:record"',
language: 'fts-alfresco',
page: {maxItems: 10}
}
Thanks,
Neil
Solved! Go to Solution.
Hi
The answer depends on exactly what you mean ..... Do you want to find...
There are several fields in the index to support such queries and some groupings which you have tried ISNULL, ISUNSET etc. I suspect you are probably looking for .......
...... -EXISTS:"gry:documentNumber"
Via the public API you can also facet on the PROPERTIES field and get reports of which properties are set over the results of a query.
Andy
Hi
The answer depends on exactly what you mean ..... Do you want to find...
There are several fields in the index to support such queries and some groupings which you have tried ISNULL, ISUNSET etc. I suspect you are probably looking for .......
...... -EXISTS:"gry:documentNumber"
Via the public API you can also facet on the PROPERTIES field and get reports of which properties are set over the results of a query.
Andy
Thanks Andy!
Your assumption was correct, the EXISTS is what I needed to find nodes that do not have a particular property. Whatever resource I was looking at may have been old and didn't seem to have that option but I do see it listed here: Search in fields | Alfresco Documentation
So my query to find nodes of a certain type that did not have the property "gry:documentNumber" became the following:
var searchObj = {
query: 'PATH:"/app:company_home/st:sites/cm:test-area/cm:documentLibrary/cm:Test//*" AND TYPE:"gry:content" AND -EXISTS:"gry:documentNumber" AND -ASPECT:"rma:record"',
language: 'fts-alfresco'
}
Neil
So, this should be the correct way for searching for the different scenarios:
and if I want to combine all of them it should be
-EXISTS:"gry:documentNumber" OR ISNULL:"gry:documentNumber" OR "gry:documentNumber":""
Am I right?
Thanks.
Hi @Telmo
Generally it is better to start a new thread rather than add to one where there is already an accepted solution - you are more likely to get a response with a new thread.
HTH,
Hi,
Is there a way to this with filterQueries ?
Something like "filterQueries:" [{"query:" "gry:documentNumber:null"}]
Thanks
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.