<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Another method more efficient than getChildAssocsByPropertyValue? in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/another-method-more-efficient-than-getchildassocsbypropertyvalue/m-p/307701#M260831</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;quick question first: You do know there is a ContentModel.PROP_TITLE constant already provided by Alfresco for use as a QName, right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In regards to your actual question: Why don't you use the title value and store it under the name property? If it must be unique, then it is better suited as cm:name. This would allow you to use getChildByName which is a bit more optimized in the DB query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Other than using a different property: Have you enabled the &amp;lt;a href="&lt;/SPAN&gt;&lt;A href="http://docs.alfresco.com/4.2/concepts/intrans-metadata-conf-patch.html" rel="nofollow noopener noreferrer"&gt;http://docs.alfresco.com/4.2/concepts/intrans-metadata-conf-patch.html&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;metadata query index patch&amp;lt;/a&amp;gt; so Alfresco creates optional DB indices? This may also impact your performance quite a bit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Axel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Apr 2015 12:18:00 GMT</pubDate>
    <dc:creator>afaust</dc:creator>
    <dc:date>2015-04-13T12:18:00Z</dc:date>
    <item>
      <title>Another method more efficient than getChildAssocsByPropertyValue?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/another-method-more-efficient-than-getchildassocsbypropertyvalue/m-p/307700#M260830</link>
      <description>Good morning,before I create a new folder on a path, I need to know if the title of this folder exists on that path. I do this to check it:&amp;nbsp;&amp;nbsp; List&amp;lt;ChildAssociationRef&amp;gt; assocs = new ArrayList&amp;lt;ChildAssociationRef&amp;gt;();&amp;nbsp;&amp;nbsp; assocs = getNodeService().getChildAssocsByPropertyValue(nodeRef,&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</description>
      <pubDate>Mon, 13 Apr 2015 08:41:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/another-method-more-efficient-than-getchildassocsbypropertyvalue/m-p/307700#M260830</guid>
      <dc:creator>spilby</dc:creator>
      <dc:date>2015-04-13T08:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Another method more efficient than getChildAssocsByPropertyValue?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/another-method-more-efficient-than-getchildassocsbypropertyvalue/m-p/307701#M260831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;quick question first: You do know there is a ContentModel.PROP_TITLE constant already provided by Alfresco for use as a QName, right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In regards to your actual question: Why don't you use the title value and store it under the name property? If it must be unique, then it is better suited as cm:name. This would allow you to use getChildByName which is a bit more optimized in the DB query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Other than using a different property: Have you enabled the &amp;lt;a href="&lt;/SPAN&gt;&lt;A href="http://docs.alfresco.com/4.2/concepts/intrans-metadata-conf-patch.html" rel="nofollow noopener noreferrer"&gt;http://docs.alfresco.com/4.2/concepts/intrans-metadata-conf-patch.html&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;metadata query index patch&amp;lt;/a&amp;gt; so Alfresco creates optional DB indices? This may also impact your performance quite a bit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Axel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Apr 2015 12:18:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/another-method-more-efficient-than-getchildassocsbypropertyvalue/m-p/307701#M260831</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2015-04-13T12:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Another method more efficient than getChildAssocsByPropertyValue?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/another-method-more-efficient-than-getchildassocsbypropertyvalue/m-p/307702#M260832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the response, AFaust. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First of all, no, I don't use ContentModel.PROP_TITLE. Only PROP_NAME. When I create a node, I do this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; properties.put(ContentModel.PROP_NAME, nodeName); &lt;BR /&gt;&amp;nbsp;&amp;nbsp; nodeRef = getNodeService().createNode(parent, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ContentModel.ASSOC_CONTAINS, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myCustomType, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties).getChildRef();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (nodeRef!=null) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QName CUSTOM_ASPECT_QNAME = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, Constants.aspectTitled);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Map&amp;lt;QName,Serializable&amp;gt; aspectValues = new HashMap&amp;lt;QName,Serializable&amp;gt;();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aspectValues.put(QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, Constants.titleProperty), myTitleName);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aspectValues.put(QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, Constants.descriptionProperty), myDescription);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; getNodeService().addAspect(nodeRef, CUSTOM_ASPECT_QNAME, aspectValues);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I put the title on the aspect. Doing this, I can see in the properties of the node created the value myTitleName on {&lt;/SPAN&gt;&lt;A href="http://www.alfresco.org/model/content/1.0}title" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}title&lt;/A&gt;&lt;SPAN&gt; and I supossed that was correct. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Isn't correct? I should add something like the following line on my code? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;properties.put(ContentModel.PROP_TITLE, myTitleName)&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or is the same? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And about the second recommendation, on our alfresco-global.properties not appears any system.metadata-query-indexes.ignored. I was'nt aware of this property so far. To enable this the value is false?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again!&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Apr 2015 13:37:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/another-method-more-efficient-than-getchildassocsbypropertyvalue/m-p/307702#M260832</guid>
      <dc:creator>spilby</dc:creator>
      <dc:date>2015-04-13T13:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Another method more efficient than getChildAssocsByPropertyValue?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/another-method-more-efficient-than-getchildassocsbypropertyvalue/m-p/307703#M260833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm doing some tests setting ContentModel.PROP_TITLE or setting the aspectTitled (code wrote before). The result is the same, both ways set the title on {&lt;/SPAN&gt;&lt;A href="http://www.alfresco.org/model/content/1.0}title" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/content/1.0}title&lt;/A&gt;&lt;SPAN&gt; property.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone knows if is really the same? Both ways are correct? In terms of performance too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And the system.metadata-query-indexes.ignored property should be false or true?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If all is ok, I need a alternative to getChildAssocsByPropertyValue like I expose on the fisrt message, please, the result time takes too long. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 09:01:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/another-method-more-efficient-than-getchildassocsbypropertyvalue/m-p/307703#M260833</guid>
      <dc:creator>spilby</dc:creator>
      <dc:date>2015-04-14T09:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Another method more efficient than getChildAssocsByPropertyValue?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/another-method-more-efficient-than-getchildassocsbypropertyvalue/m-p/307704#M260834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;using PROP_TITLE is fully identical. This is due to the fact that the QName you manually construct consists of the same components that are used in constructing the constant.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You know, you can also merge the createNode with the addAspect into one call to createNode by putting the aspect properties in the same properties map you put PROP_NAME into. Alfresco will automatically add the aspect when you use any of its properties, so there is no need for an extra addAspect call.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;system.metadata-query-indexes.ignored should be "false" to ensure your DB has the extra indices to potentially improve performance. But as I said, using PROP_NAME for the unique value you perform lookups by (using getChildByName) may be the best option for better performance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You might also want to try logging the individual SQL used to lookup the node and look at the individual durations. Then if you find a specific SQL that is taking too long, you can have your RDBMS explain the query plan to you. Using &amp;lt;a href="&lt;/SPAN&gt;&lt;A href="https://wiki.alfresco.com/wiki/Driver-side_DB_Query_Profiling" rel="nofollow noopener noreferrer"&gt;https://wiki.alfresco.com/wiki/Driver-side_DB_Query_Profiling&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;driver-side logging via p6spy&amp;lt;/a&amp;gt; is a good place to start…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Axel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 10:11:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/another-method-more-efficient-than-getchildassocsbypropertyvalue/m-p/307704#M260834</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2015-04-14T10:11:12Z</dc:date>
    </item>
  </channel>
</rss>

