<?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 query with pagination in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/lucene-query-with-pagination/m-p/103268#M29422</link>
    <description>&lt;P&gt;I am trying to reduce the search resullt using lunene query with pagination option.(maxItems and skipCount).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can any one help me to write a lucene query with pagination option.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Alfrescolucene.JPG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/792iE094A377540A5B3A/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlfrescoLuceneResult.JPG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/793i9CF4648A7969988B/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Aug 2020 22:29:04 GMT</pubDate>
    <dc:creator>mdmustaf</dc:creator>
    <dc:date>2020-08-18T22:29:04Z</dc:date>
    <item>
      <title>Lucene query with pagination</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/lucene-query-with-pagination/m-p/103268#M29422</link>
      <description>&lt;P&gt;I am trying to reduce the search resullt using lunene query with pagination option.(maxItems and skipCount).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can any one help me to write a lucene query with pagination option.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Alfrescolucene.JPG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/792iE094A377540A5B3A/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlfrescoLuceneResult.JPG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/793i9CF4648A7969988B/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 22:29:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/lucene-query-with-pagination/m-p/103268#M29422</guid>
      <dc:creator>mdmustaf</dc:creator>
      <dc:date>2020-08-18T22:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Lucene query with pagination</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/lucene-query-with-pagination/m-p/103269#M29423</link>
      <description>&lt;P&gt;You can also use &lt;A href="https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest-finding-content-by-search-query.html" target="_blank" rel="noopener nofollow noreferrer"&gt;Search V1 Rest API:&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;A href="https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest-finding-content-by-search-query.html" target="_blank" rel="noopener nofollow noreferrer"&gt;Query example:&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;{
  "query": {
    "query": "+TYPE:\"cm:content\"",
    "language": "afts"
  },
  "paging": {
    "maxItems": "25",
    "skipCount": "10"
  },
  "sort": [{"type":"FIELD", "field":"cm:name", "ascending":"false"}]
}&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;PRE class="pre codeblock prettyprint prettyprinted"&gt;&lt;SPAN class="pln"&gt; curl &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;-&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;X POST &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;-&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;H &lt;/SPAN&gt;&lt;SPAN class="str"&gt;'Content-Type: application/json'&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;-&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;H &lt;/SPAN&gt;&lt;SPAN class="str"&gt;'Accept: application/json'&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;--&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;header &lt;/SPAN&gt;&lt;SPAN class="str"&gt;'Authorization: Basic VElDS0VUXzIxYzAzOWMxNjFjYzljMDNmNmNlMzAwYzAyMDY5YTQ2OTQwZmYzZmM='&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;--&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;data&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;-&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;binary &lt;/SPAN&gt;&lt;SPAN class="str"&gt;'@paging-sort-query.json'&lt;/SPAN&gt; &lt;SPAN class="str"&gt;'http://localhost:8080/alfresco/api/-default-/public/search/versions/1/search'&lt;/SPAN&gt;&lt;/PRE&gt;

&lt;P&gt;Alternatively, if you prefer to write your own webscript,&amp;nbsp;Have a look at the WebScript in the post &lt;A href="https://hub.alfresco.com/t5/alfresco-content-services-forum/is-there-any-endpoint-in-alfresco-that-allows-applying-the/m-p/299969/highlight/true#M20042" target="_blank" rel="noopener nofollow noreferrer"&gt;here&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN style="white-space: normal; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;"&gt;var contentType = "cm:content"&lt;BR /&gt;var aspectName = "demo:webable"&lt;BR /&gt;&lt;BR /&gt;var query = 'PATH:"/app:company_home/st:sites//*" AND TYPE:"'+contentType+'" AND NOT ASPECT:"'+aspectName+'" AND NOT ASPECT:"cm:lockable"';&lt;/SPAN&gt;
	&lt;BR /&gt;var page = {
	skipCount : 0,
	maxItems : 1000
	&lt;BR /&gt;};

  var searchQuery = {
	query : query,
	language : "lucene",
	page : page
  };
	
 logger.log("Query for search: "+query)
 var nodes = search.query(searchQuery); &lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://hub.alfresco.com/t5/alfresco-content-services-forum/is-there-any-endpoint-in-alfresco-that-allows-applying-the/m-p/299969/highlight/true#M20042" target="_blank" rel="noopener nofollow noreferrer"&gt;https://hub.alfresco.com/t5/alfresco-content-services-forum/is-there-any-endpoint-in-alfresco-that-allows-applying-the/m-p/299969/highlight/true#M20042&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It searches the repository with paginated options and adds a missing aspect.&amp;nbsp;&lt;BR /&gt;you can take reference from the script.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 22:51:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/lucene-query-with-pagination/m-p/103269#M29423</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-08-18T22:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Lucene query with pagination</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/lucene-query-with-pagination/m-p/103270#M29424</link>
      <description>&lt;P&gt;The original poster is clearly using Alfresco 4.2 or earlier, which still supported Alfresco Explorer, so they cannot use v1 ReST API at all, which were only added in Alfresco 5.2.&lt;/P&gt;
&lt;P&gt;The suggestion with using JavaScript API in a web script is appropriate - alternative, Java API in a Java-backed web script or any other component where you need the query is also possible. Within the Node Browser, which the OP posted as a screenshot, there is no support for pagination. The query itself can also not be rewritten to use pagination - pagination absolutely requires the use of query-external search parameters.&lt;/P&gt;
&lt;P&gt;With regards to using Lucene: This is quite an old and deprecated search query language. In Alfresco 4.x, you can already use Alfresco FTS (AFTS / fts-alfresco) which is the recommended query language for cross-version support, and which also receives performance improvements and new features, such as TMQ. Apart from Alfresco 3.x and earlier versions, Lucene should be avoided.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 11:10:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/lucene-query-with-pagination/m-p/103270#M29424</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2020-08-19T11:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Lucene query with pagination</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/lucene-query-with-pagination/m-p/103271#M29425</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks for the reply.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;public&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;static&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;final&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;String&amp;nbsp;QUERY_LANGUAGE&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"lucene"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;String lucenequery=&amp;nbsp;"+@cm\\:categories:\"*" + "0a2ac5ef-bf4b-41e9-9926-9f89269a20d7" + "*\"";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;log.info(&lt;/SPAN&gt;&lt;SPAN&gt;"Starting&amp;nbsp;search&amp;nbsp;type="&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;+&amp;nbsp;QUERY_LANGUAGE);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;log.info(&lt;/SPAN&gt;&lt;SPAN&gt;"Query:&amp;nbsp;"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;+&amp;nbsp;QUERY);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;org.alfresco.webservice.repository.RepositoryServiceSoapPort&lt;/STRONG&gt;&amp;nbsp;repo&amp;nbsp;=&amp;nbsp;ctx.getClient().create(Endpoint.REPO_SERVICE);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Query&amp;nbsp;query&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;Query();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;query.setLanguage(QUERY_LANGUAGE);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;query.setStatement(lucenequery.toString());&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;QueryResult&amp;nbsp;result&amp;nbsp;=&amp;nbsp;repo.query(SPACES_STORE,&amp;nbsp;query,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;We are using&amp;nbsp;&lt;STRONG&gt;RepositoryServiceSoapPort.java&amp;nbsp;&lt;/STRONG&gt;class to get related asset belong to particular category. How do we add condition like maxItems and skipCount to implement pagination here.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Take an example: If category 'A' contains 10000 assets&amp;nbsp; but we want get top 100 assets for first query and for next query we have to get next 100 and so on.&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 19 Aug 2020 13:58:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/lucene-query-with-pagination/m-p/103271#M29425</guid>
      <dc:creator>mdmustaf</dc:creator>
      <dc:date>2020-08-19T13:58:42Z</dc:date>
    </item>
  </channel>
</rss>

