cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene search sort troubles

lista
Star Contributor
Star Contributor
I'm having troubles understanding how the sort works.
When I take a look at the script below, I expect to get a result-set ordered by title. However, this is not the case, and instead I get the result-set that can also be found below.

Any ideas why this happens?

var logFile = userhome.childByNamePath("test.txt");

if (logFile == null) {
   var logFile = userhome.createNode("test.txt", "cm:content");
}

var sortby = "@" + "cm:title";
var query = "PATH:\"" + "/app:company_home/cm:test" + "//*\"";
query += " AND " + "ASPECT:\"" + "cm:folder" + "\"";

var results = search.luceneSearch(query, sortby, false);
   
for each (result in results) {
   logFile.content += result.properties["cm:title"] + "\n";
}

vtest3 vtest3_1273647023066.tiff
UP1_Ulazna
UP1_Izlazna_1
UP1_6
UP1_5
UP1_4
test9
test8
test7
test66
test6
test55
test5
test4
test3
test22
test2
test10
test
test
test
racun
NEUPasdasd
asdhasdhdlhkasdhl
asdadasd
333333
222222
21e12e2sdss
test
tes1111111
test123123
test2
test3
test1
test2
test3
test4
test5
test6
test19
test13
test8
1414
1515
1616
1717
1 REPLY 1

lista
Star Contributor
Star Contributor
If I exclude the PATH part of the query, the sort appears to work fine. It looks to me that in case of using PATH as a part of your query, 'sort-by' sorts sub-folder by sub-folder, thus making the complete result-set look out of order. Can anyone reproduce this and possibly confirm the issue?