Search for nodes that do not have a property

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member II

Search for nodes that do not have a property

Jump to solution

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

1 Solution

Accepted Solutions
Highlighted
Senior Member

Re: Search for nodes that do not have a property

Jump to solution

Hi

The answer depends on exactly what you mean ..... Do you want to find...

  1. Nodes that do not have the property at all?
  2. Nodes that have a null value for the property?
  3. Nodes that have an empty string value for the property?
  4. Nodes that are unqueryable as they generate no full text search tokens?
  5. Multi-valued properties where any one of the values is null?
  6. Some combination of the above.

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

View solution in original post

2 Replies
Highlighted
Senior Member

Re: Search for nodes that do not have a property

Jump to solution

Hi

The answer depends on exactly what you mean ..... Do you want to find...

  1. Nodes that do not have the property at all?
  2. Nodes that have a null value for the property?
  3. Nodes that have an empty string value for the property?
  4. Nodes that are unqueryable as they generate no full text search tokens?
  5. Multi-valued properties where any one of the values is null?
  6. Some combination of the above.

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

View solution in original post

Highlighted
Active Member II

Re: Search for nodes that do not have a property

Jump to solution

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