2

I'm thinking how to do this:

I have a java backed webscript and need to upload documents. Some of them will be full indexed (content and metadata) and others only index the metadata.

I have read this way to add a custom aspect on model.xml

<aspect name="my:doNotIndexContentControl">
<title>Do Not Index Control</title>
<parent>cm:indexControl</parent>
<overrides>
    <property name="cm:isIndexed">
       <default>true</default>
    </property>
    <property name="cm:isContentIndexed">
       <default>false</default>
    </property>
</overrides>

<aspect name="my:doIndexContentControl">
<title>Index Control</title>
<parent>cm:indexControl</parent>
<overrides>
    <property name="cm:isIndexed">
       <default>true</default>
    </property>
    <property name="cm:isContentIndexed">
       <default>true</default>
    </property>
</overrides>

And I imagine that if I add on my webscript:

getNodeService().addAspect(nodeRef, "my:doNotIndexContentControl", null);

or

getNodeService().addAspect(nodeRef, "my:doIndexContentControl", null);

it puts my custom aspect defined on model in the nodeRef. Is the best solution for my problem? What do you think? Any recommentation?

Thanks!

tkruse
  • 10,222
  • 7
  • 53
  • 80
Jordi
  • 43
  • 8

1 Answers1

1

You could do this. Other way to achieve is to create rule on top of folder under which you are uploading those contents. That rule can add those aspect on new items based on criterias.

But in that case you will have to clearly define criteria which will distinguish between items to be indexed and not to be indexed.

mitpatoliya
  • 2,037
  • 12
  • 23
  • Oh, ok. I didn't know how make rules, I'm read about it just now. I understand that a rule on my main folder add the aspect that I wrote before. And is possible to make rules with Alfresco share, and add a new one based on a type, for example. Thanks for the idea. Only one question... Why is better doing a rule than add the aspect throw the java code with the nodeService? Maybe for performance? Reduce the cost? Or is the same? – Jordi Jul 08 '15 at 08:18