cancel
Showing results for 
Search instead for 
Did you mean: 

Filter showing nodes with missing mandatory properties

billerby
Champ on-the-rise
Champ on-the-rise
I need to develop a new Share filter for the Document library. My intention is that the filter will show all nodes in a site with missing values for mandatory properties.

Is it possible to ask Lucene for nodes with missing mandatory values in any way?

If thats not possible my only idea is to use the data dictionary services and loop through the property definitions of all types and then query all nodes of a site. Seems a bit resource demanding though  :cry:

Please, dont hesitate to share some other better ideas with me Smiley Happy

Regards
/Erik
4 REPLIES 4

loftux
Star Contributor
Star Contributor
in filter.lib.js
         case "incomplete":
             filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\"";
             filterQuery += " AND (ISUNSET:\"{http://www.example.com/model/content/1.0}agreementNumber\"";
             filterQuery += " ISUNSET:\"{http://www.example.com/model/content/1.0}myCompany\"";
             filterQuery += " ISUNSET:\"{http://www.example.com/model/content/1.0}party\"";
             filterQuery += " ISUNSET:\"{http://www.example.com/model/content/1.0}expirationDate\"";
             filterQuery += " ISUNSET:\"{http://www.example.com/model/content/1.0}noticeTime\"";
             filterQuery += ") "
             break;
 

More to find here http://wiki.alfresco.com/wiki/Full_Text_Search_Query_Syntax#Fields
You probably just have to query a one of the properties if it is unset if they are on the same form, since you get an all or nothing situation.

mrogers
Star Contributor
Star Contributor
A missing mandatory property should not be possible.    If the data model specifies the field as mandatory then a value must be specified.

loftux
Star Contributor
Star Contributor
A missing mandatory property should not be possible.    If the data model specifies the field as mandatory then a value must be specified.
True, but if you have a custom type, and convert cm:content to that type, and forget to visit edit metadata page, you have document with mandatory properties not set. And those are the ones you want to find. Especially if you enable setting the document type in the upload dialog, and upload many documents at the same time.

billerby
Champ on-the-rise
Champ on-the-rise
Hi again,

I have another idea that seems more general. It seems like Alfresco applies the aspect sys:incomplete on a node whenever the node have unset mandatory properties. Then it should be possible to filter out all nodes in a site with this aspect set?

This way I do not have to update my filter every time a new mandatory property is added in my data definitions.

Regards
/Erik