var alfQuery = '+TYPE:"cm:person" ';
var sort =
{
column: "@{http://www.alfresco.org/model/content/1.0}firstName",
ascending: true
};
var nodes = search.luceneSearch(alfQuery, sort, true),
Esto me saca los resultados totalmente desordenados.…
<property name="cm:firstName">
<type>d:text</type>
<mandatory>true</mandatory>
<index enabled="true">
<atomic>false</atomic>
<stored>false</stored>
<tokenised>both</tokenised>
</index>
</property>
…
He probado varias combinaciones, tokenised en false y true, atomic en true y false, …var nodes = search.luceneSearch(alfQuery, "@cm:firstName", true);
Array query(object search)
Returns an array of ScriptNode objects representing the search results. The 'search' object defines the search to be executed as is constructed in this way:
search
{
query: string, mandatory, in appropriate format and encoded for the given language
store: string, optional, defaults to 'workspace://SpacesStore'
language: string, optional, one of: lucene, xpath, jcr-xpath, fts-alfresco, cmis-alfresco, cmis-strict - defaults to 'lucene'
sort: [], optional, Array of sort column options (see below)
page: object optional, paging information object (see below) - if supported by the language
}
sort
{
column: string, mandatory, sort column in appropriate format for the language
ascending: boolean optional, defaults to false
}
page
{
maxItems: int, optional, max number of items to return in result set
skipCount: int optional, number of items to skip over before returning results (NOT IMPLEMENTED YET)
}
The search definition object an be as simple to use as:
var results = search.query({query: "TEXT:alfresco"});
Or as richly defined as:
var sort1 =
{
column: "@{http://www.alfresco.org/model/content/1.0}modified",
ascending: false
};
var sort2 =
{
column: "@{http://www.alfresco.org/model/content/1.0}created",
ascending: false
};
var paging =
{
maxItems: 100,
skipCount: 0
};
var def =
{
query: "cm:name:test*",
store: "workspace://SpacesStore",
language: "fts-alfresco",
sort: [sort1, sort2],
page: paging
};
var results = search.query(def);
Multi-column sorting and any of the Alfresco search languages are supported through this interface. The search definition objects may be extended with additional properties in future versions of the API but backward compatibility will be maintained.
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.