<?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 xpathSearch error in 4.0a in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/xpathsearch-error-in-4-0a/m-p/269337#M222467</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I installed Javascript Console 0.4.3 on my Alfresco 4.0a and got errors on the search.xpathSearch call that it uses to find any javascripts that should be included before executing the javascript typed into its text box.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Researching the Alfresco documentation, the call seemed correct and is shown below.&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;&amp;nbsp;&amp;nbsp; var includeFolder = search.xpathSearch("/app:company_home/app:dictionary")[0].childByNamePath("Javascript Console Includes");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!includeFolder) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logger.log("Creating new Javascript Console Includes folder"); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var dictionary = search.xpathSearch("/app:company_home/app:dictionary")[0];&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; includeFolder = dictionary.createNode("Javascript Console Includes", "cm:folder", [], "cm:contains", "app:jsincludes");&lt;BR /&gt;&amp;nbsp;&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;By commenting this code out of the JavaScript Console script files I was able to run the Console and then try and execute an xpathSearch from within the Console itself. Even reproducing the xpathSearch call in the on-line documentation for xpathSearch in Alfresco 4.0 I got an error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Searching JIRA turned up ALF-10663 which is that if you selected xpath off the search type drop down list in the Node Browser you got an "Unknown language type" error but this is far from the same error as I got in Javascript Console and the suggestion in the JIRA is that this was because the option for xpath just needed removing from the drop down. The JIRA is marked as complete, but how or in which version of Alfresco it was completed is unclear and whether or not it caused a change in xpathSearch java code is not specified.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I changed the search.xpathSearch to search.query using the fts-alfresco language as shown below and everything worked fine&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var def =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query: 'PATH:"/app:company_home/app:dictionary"',&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; language: "fts-alfresco"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var results = search.query(def);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var includeFolder = results[0].childByNamePath("Javascript Console Includes");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!includeFolder) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;dictionary = results[0];&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; includeFolder = dictionary.createNode("Javascript Console Includes", "cm:folder", [], "cm:contains", "app:jsincludes");&lt;BR /&gt;&amp;nbsp;&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I am making this log in case anyone else with 4.0a is experiencing difficulties with xpathSearch or Javascript Console and to ask whether or not there is a bug in 4.0a which affects xpathSearch which is subsequently fixed in 4.0b+ or if xpathSearch is actually no longer available or if the the syntax changed from that which is in the documentation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Bob Johnson&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Feb 2012 18:15:52 GMT</pubDate>
    <dc:creator>rjohnson</dc:creator>
    <dc:date>2012-02-29T18:15:52Z</dc:date>
    <item>
      <title>xpathSearch error in 4.0a</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/xpathsearch-error-in-4-0a/m-p/269337#M222467</link>
      <description>I installed Javascript Console 0.4.3 on my Alfresco 4.0a and got errors on the search.xpathSearch call that it uses to find any javascripts that should be included before executing the javascript typed into its text box.Researching the Alfresco documentation, the call seemed correct and is shown bel</description>
      <pubDate>Wed, 29 Feb 2012 18:15:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/xpathsearch-error-in-4-0a/m-p/269337#M222467</guid>
      <dc:creator>rjohnson</dc:creator>
      <dc:date>2012-02-29T18:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: xpathSearch error in 4.0a</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/xpathsearch-error-in-4-0a/m-p/269338#M222468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It was not there 4.0a and has been added back in.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We make more use of SearchService.selectNodes() in 4.0. It gets used more as we have removed dependencies on lucene.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The repo and most of the app will run without a lucene or SOLR index.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So it should work but for some things you can avoid using the lucene or solr index - a simple PATH look up, as you have here, will be fine doing selectNodes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Just avoid //*[cm:name …..] which will walk the repo&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Feb 2012 19:38:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/xpathsearch-error-in-4-0a/m-p/269338#M222468</guid>
      <dc:creator>andy</dc:creator>
      <dc:date>2012-02-29T19:38:53Z</dc:date>
    </item>
  </channel>
</rss>

