04-08-2011 07:40 AM
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, …04-12-2011 08:18 AM
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.
04-13-2011 03:11 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.