<?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 lucene search for one file in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/lucene-search-for-one-file/m-p/222232#M175362</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to add/update a file in Alfresco.&amp;nbsp; In order to do this I need to see if the file is already in alfresco so I can choose either CMLCreate vs CMLUpdate. I have been through the wiki tutorial, and i try this search:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;+PATH:"/app:company_home/cm&lt;img id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://connect.hyland.com/i/smilies/16x16_smiley-surprised.png" alt="Smiley Surprised" title="Smiley Surprised" /&gt;perations/cm:Reports/cm:myReport"+@cm\:name:"myReport.xls"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(yes, the directory is called myReport, and in that space, the file myReport.xls resides.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;it returns nothing, but it's there. I can see it. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know the path and the name of the file, what is the correct lucene search to return a ResultSet for that file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alternatively, is there any code example that would do this: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;ParentReference contentReference = new ParentReference(storeRef,null,path,ASSOC_CONTAINS,ASSOC_CONTAINS);&lt;BR /&gt;CMLCreate createDoc = new CMLCreate("ref1", contentReference, null, null, null, Constants.createQNameString(NAMESPACE, "report"), contentProps);&lt;BR /&gt;cml.setCreate(new CMLCreate[]{createDoc});&lt;BR /&gt;UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml);&lt;BR /&gt;Reference newContentNode = result[0].getDestination();&lt;BR /&gt;ContentFormat&amp;nbsp; format = new ContentFormat("application/excel", "UTF-8");&lt;BR /&gt;WebServiceFactory.getContentService().write(newContentNode, Constants.PROP_CONTENT, bytes, format);&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;without that annoying&amp;nbsp; "Duplicate child name not allowed"&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Jul 2010 03:49:16 GMT</pubDate>
    <dc:creator>mangar</dc:creator>
    <dc:date>2010-07-08T03:49:16Z</dc:date>
    <item>
      <title>lucene search for one file</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/lucene-search-for-one-file/m-p/222232#M175362</link>
      <description>I am trying to add/update a file in Alfresco.&amp;nbsp; In order to do this I need to see if the file is already in alfresco so I can choose either CMLCreate vs CMLUpdate. I have been through the wiki tutorial, and i try this search:+PATH:"/app:company_home/cm&lt;IMG id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://migration33.stage.lithium.com/i/smilies/16x16_smiley-surprised.png" alt="Smiley Surprised" title="Smiley Surprised" /&gt;perations/cm:Reports/cm:myReport"+@cm\:name:"my</description>
      <pubDate>Thu, 08 Jul 2010 03:49:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/lucene-search-for-one-file/m-p/222232#M175362</guid>
      <dc:creator>mangar</dc:creator>
      <dc:date>2010-07-08T03:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: lucene search for one file</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/lucene-search-for-one-file/m-p/222233#M175363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You have to add for your PATH token this string "/*" to allow Lucene to search for all the child nodes in that space:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;String luceneQuery = "+PATH:\"/app:company_home/cm:Operations/cm:Reports/cm:myReport/*\" +@cm\\:name:\"myReport.xls\"";&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;SPAN&gt;You have to encode all the space names in the ISO 9075 format, this because Alfresco store paths in that format. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Try to encode the Lucene query in this way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;String luceneQuery = "+PATH:\"/app:company_home/cm:"+ISO9075.encode("Operations")+"/cm:"+ISO9075.encode("Reports")+"/cm:"+ISO9075.encode("myReport")+"/*\" +@cm\\:name:\"myReport.xls\"";&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;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jul 2010 10:29:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/lucene-search-for-one-file/m-p/222233#M175363</guid>
      <dc:creator>openpj</dc:creator>
      <dc:date>2010-07-08T10:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: lucene search for one file</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/lucene-search-for-one-file/m-p/222234#M175364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you&amp;nbsp; so much!&amp;nbsp; Without that * I was looking for a specific directory with a filename, never going to happen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Everything works great, thank you!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jul 2010 14:10:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/lucene-search-for-one-file/m-p/222234#M175364</guid>
      <dc:creator>mangar</dc:creator>
      <dc:date>2010-07-08T14:10:57Z</dc:date>
    </item>
  </channel>
</rss>

