AnsweredAssumed Answered

Search performance issues using searchService

Question asked by lista on Oct 1, 2012
Latest reply on Oct 9, 2012 by lista
Hi all,

i have about 70k nodes, under a structure like this:

-main space
–subspace based on node's first character
—node
—node

Searching for a specific node is a practically instant through Alfresco Explorer, but when using API it takes about 7 seconds (just to show the difference).
Here's the concrete code at fault:

SearchParameters parameters = new SearchParameters();
parameters.addStore(STORE_REF);
parameters.setLanguage(SearchService.LANGUAGE_LUCENE);
parameters.addSort("@" + sortQName, sortIsAsc);
parameters.setQuery(query);
parameters.addLocale(locale);

results = searchService.query(parameters);

Lucene query is basic, nothing complicated, and Alfresco in play is 3.4.

The interesting part comes now; when I remove the sort part, it works almost as fast as through Alfresco Explorer, and it definitely stops being a performance issue.
How do you explain this, and does anyone have any concrete advice?

Outcomes