09-30-2017 09:11 PM
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
10-02-2017 04:52 AM
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
10-02-2017 04:52 AM
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
10-02-2017 10:30 AM
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
05-27-2021 01:31 PM
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.
05-28-2021 09:42 AM
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,
10-29-2021 10:13 AM
Hi,
Is there a way to this with filterQueries ?
Something like "filterQueries:" [{"query:" "gry:documentNumber:null"}]
Thanks
Explore our Alfresco products with the links below. Use labels to filter content by product module.