user1907906
user1907906

Reputation:

Find nodes with cm:isIndexed = false

I am working on a large Alfresco installation where an unknown number of nodes have the aspect cm:indexControl and the property cm:isIndexed set to false. Of course, these nodes can not be found in a Solr search.

Is there a way to find all these nodes and remove aspect and property to trigger Solr to index them?

Upvotes: 1

Views: 405

Answers (1)

Thomas
Thomas

Reputation: 1312

You can try to use Alfrescos underlying database instead of walking the tree. I have to admit it's a bit unorthodox, but definitely works.

In the first step you just need to find out some primary keys to ease your count query. The following little queries should help your to find the required information: To find out the primary key of cm:indexControl aspect's qname use the following one. In my case it was 90.

SELECT * FROM alfresco.alf_qname  WHERE local_name ="indexControl";

The cm:isIndexed property had the PK 89.

SELECT * FROM alfresco.alf_qname  WHERE local_name ="isIndexed";

To get the PK of your workspace://SpacesStore store

SELECT * FROM alfresco.alf_store;

I assume the workspace://SpacesStore has the PK 6.

Now the preparation is done, you should have all required information and can trigger the query that counts all nodes that have a cm:indexControl aspect with a cm:isIndexed property set to false and located in the workspace://SpacesStore store.

SELECT Distinct count(*) FROM alfresco.alf_node_aspects a, alfresco.alf_node n, alf_node_properties p 
WHERE a.qname_id=90 
AND a.node_id = n.id 
AND p.node_id = n.id
AND p.boolean_value=0
AND p.qname_id =89
AND n.store_id = 6;

Upvotes: 1

Related Questions