cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene LIMITBY

koenv
Champ in-the-making
Champ in-the-making
Hello,

I'm trying to limit a lucene search but still got more results then asked.

s.setLanguage(SearchService.LANGUAGE_LUCENE);
s.setLimitBy(LimitBy.FINAL_SIZE);
s.setLimit(1000);
s.setQuery(query);
s.addStore(storeRef);

Still having results with thousands of records.
If i try to read only the first 1000 records of the big result, it is very slow!

I am running this as System User … on Alfresco Enterprise 2.2

Anyone idea what is the problem?

thanks,
Koen
4 REPLIES 4

koenv
Champ in-the-making
Champ in-the-making
More concrete update of description above:

I'm trying to limit lucene search results with following code:

a)   
SearchParameters s = new ..

s.setLanguage(SearchService.LANGUAGE_LUCENE);
s.setLimitBy(LimitBy.FINAL_SIZE);
s.setLimit(1000);
s.setQuery(query);
s.addStore(storeRef);


You can read on http://wiki.alfresco.com/wiki/Search:
“The maximum size of the result set can be set. The return results set will be no bigger than this size.”

I still get a result set with thousands of records.


b)If I try to read only the first 1000 records of the big result (700000hits), it is very slow! (>5 seconds)
This only happens when a PATH is specified in the query.

int i=0;
for (ResultSetRow row : results)
{
NodeRef currentNodeRef = row.getNodeRef(); nodeList.add(currentNodeRef);
      i++;
if (i > 1000) break;
}

Example:

“+TYPE:"cm:content" +@cm\:name:"*1234*"  +PATH:"/app:company_home/cm:test//*"

runs much slower than the same query without a path.

“+TYPE:"cm:content" +@cm\:name:"*1234*"  " ”



Note: I am running this as System User … on Alfresco Enterprise 2.2

kdejaeger
Champ in-the-making
Champ in-the-making
Do you mean that the query runs slower with the PATH or that iterating though the resultset runs slower with the PATH?

koenv
Champ in-the-making
Champ in-the-making
With PATH the query runs slower and the iteration is much slower!

koenv
Champ in-the-making
Champ in-the-making
1)

QUERY=+TYPE:"cm:content" +@cm\:name:"*1234*"

time to search=1012ms
result size=254
iteration time=31ms

total time= 1043ms

2)

QUERY=+TYPE:"cm:content" +@cm\:name:"*1234*"  +PATH:"/app:company_home/cm:test//*"

time to search=1446ms
result size=254
iteration time=893ms

total time = 2339ms;