<?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: SearchParameters and sorting by date in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171536#M124781</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No problem.&amp;nbsp; Assuming your namespace is "&lt;/SPAN&gt;&lt;A href="http://www.example.com/name/space" rel="nofollow noopener noreferrer"&gt;http://www.example.com/name/space&lt;/A&gt;&lt;SPAN&gt;" and you want to sort of field "sort" then what you want to pass to addSort would be like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;searchParams.addSort("@{&lt;A href="http://www.example.com/name/space}sort" rel="nofollow noopener noreferrer"&gt;http://www.example.com/name/space}sort&lt;/A&gt;", true);&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;SPAN&gt;When building a query you want to escape any special characters for Lucene like '{', ':', and '}', but for sorting you do &lt;/SPAN&gt;&lt;EM&gt;not&lt;/EM&gt;&lt;SPAN&gt; want to escape these characters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For performance sake it's best if your sort field is not a string if you can help it.&amp;nbsp; String sorting is apparently the most expensive sort for Lucene.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Apr 2008 13:11:27 GMT</pubDate>
    <dc:creator>morgan_david</dc:creator>
    <dc:date>2008-04-16T13:11:27Z</dc:date>
    <item>
      <title>SearchParameters and sorting by date</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171532#M124777</link>
      <description>I'm using the Java foundation APIs for searching the repository and I'm trying to apply a sort on a date field. Code example of what I'm trying to do:From model:&amp;lt;property name="ident:identDate"&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;type&amp;gt;d:date&amp;lt;/type&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;mandatory&amp;gt;true&amp;lt;/mandatory&amp;gt;&amp;lt;/property&amp;gt;‍‍‍‍‍</description>
      <pubDate>Wed, 19 Mar 2008 19:31:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171532#M124777</guid>
      <dc:creator>morgan_david</dc:creator>
      <dc:date>2008-03-19T19:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: SearchParameters and sorting by date</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171533#M124778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I've looked a little more into this.&amp;nbsp; Lucene won't sort on a tokenized field.&amp;nbsp; So I've added another field that mimics the date field except it's just an int and it's stored untokenized.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;lt;property name="ident:identDateSort"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;type&amp;gt;d:int&amp;lt;/type&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;mandatory&amp;gt;true&amp;lt;/mandatory&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;index enabled="true"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;tokenised&amp;gt;false&amp;lt;/tokenised&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/index&amp;gt;&lt;BR /&gt;&amp;lt;/property&amp;gt;&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately things still aren't sorting.&amp;nbsp; What am I doing wrong?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2008 12:46:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171533#M124778</guid>
      <dc:creator>morgan_david</dc:creator>
      <dc:date>2008-04-11T12:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: SearchParameters and sorting by date</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171534#M124779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I figured out what I was doing wrong.&amp;nbsp; I was passing the wrong field namespace.&amp;nbsp; Once I passed in the right namespace &lt;/SPAN&gt;&lt;EM&gt;and&lt;/EM&gt;&lt;SPAN&gt; stopped escaping some characters sorting started working.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2008 14:42:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171534#M124779</guid>
      <dc:creator>morgan_david</dc:creator>
      <dc:date>2008-04-11T14:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: SearchParameters and sorting by date</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171535#M124780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I figured out what I was doing wrong.&amp;nbsp; I was passing the wrong field namespace.&amp;nbsp; Once I passed in the right namespace &lt;EM&gt;and&lt;/EM&gt; stopped escaping some characters sorting started working.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to do the same thing RE: sorting. Would you mind posting the correct syntax for the example you gave above - would really help me out&amp;nbsp; &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://connect.hyland.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Apr 2008 08:55:22 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171535#M124780</guid>
      <dc:creator>chrisb</dc:creator>
      <dc:date>2008-04-16T08:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: SearchParameters and sorting by date</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171536#M124781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No problem.&amp;nbsp; Assuming your namespace is "&lt;/SPAN&gt;&lt;A href="http://www.example.com/name/space" rel="nofollow noopener noreferrer"&gt;http://www.example.com/name/space&lt;/A&gt;&lt;SPAN&gt;" and you want to sort of field "sort" then what you want to pass to addSort would be like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;searchParams.addSort("@{&lt;A href="http://www.example.com/name/space}sort" rel="nofollow noopener noreferrer"&gt;http://www.example.com/name/space}sort&lt;/A&gt;", true);&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;SPAN&gt;When building a query you want to escape any special characters for Lucene like '{', ':', and '}', but for sorting you do &lt;/SPAN&gt;&lt;EM&gt;not&lt;/EM&gt;&lt;SPAN&gt; want to escape these characters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For performance sake it's best if your sort field is not a string if you can help it.&amp;nbsp; String sorting is apparently the most expensive sort for Lucene.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Apr 2008 13:11:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171536#M124781</guid>
      <dc:creator>morgan_david</dc:creator>
      <dc:date>2008-04-16T13:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: SearchParameters and sorting by date</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171537#M124782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the quick reply and the explanation - much appreciated, and exactly what I was after&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; .&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Apr 2008 13:22:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171537#M124782</guid>
      <dc:creator>chrisb</dc:creator>
      <dc:date>2008-04-16T13:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: SearchParameters and sorting by date</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171538#M124783</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;You can sort on date properties even when tokenised. Date does not include time in the index by default. (It can be configured to use time and sort is still supported - we build the additional column required for sort internally in this configuration)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Stricly, lucene only fails to order if there is more than one token per doc (even if there are no docs for some and nonefor others)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This may have changed in later versions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Andy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2008 10:14:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/searchparameters-and-sorting-by-date/m-p/171538#M124783</guid>
      <dc:creator>andy</dc:creator>
      <dc:date>2008-07-15T10:14:13Z</dc:date>
    </item>
  </channel>
</rss>

