Has anyone had any luck using lucene's built in sort functions to sort first by the lucene hit score and secondarily by a Field in each document indexed as Keyword and in integer form?
I get multiple sort fields to work, here's two examples:
new Sort(new SortField[]{ new SortField("category"), SortField.FIELD_SCORE, new SortField("pubmonth", SortField.INT, true) });
new Sort(new SortField[] {SortField.FIELD_SCORE, new SortField("category")})
Both of these, on a tiny dataset of only 10 documents, works exactly as expected.
I can only get it to sort by one or the other... but when it does one, it does sort correctly, but together in {score, custom_field} only the first sort seems to apply.
Any ideas?
Are you using Lucene 1.4.2? How did you index your integer field? Are you simply using the .toString() of an Integer? Or zero padding the field somehow? You can use the .toString method, but you have to be sure that the sorting code does the right parsing of it - so you might need to specify SortField.INT as its type. It will do automatic detection if the type is not specified, but that assumes that the first document it encounters parses properly, otherwise it will fall back to using a String sort.
Erik
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]