Forums / Install & configuration / Lucene: sort by score

Lucene: sort by score

Author Message

Børge Warvik

Wednesday 02 May 2007 5:58:08 am

Hi,

I've just had Lucene installed on my server, and I can't find out how to sort the result by the given score (percentage). Anyone now how to do this?

Thanks,
Børge Warvik

Peter Putzer

Wednesday 02 May 2007 7:27:14 am

I've written a (currently unpublished) extension for this purpose. It's a template operator that takes a Lucene result set and returns it sorted by score. It's not documented or anything, but if you like, I can publish it on /community/contrib.

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

Børge Warvik

Wednesday 02 May 2007 8:05:46 am

Hi,

that would be nice. Please do.

Thanks,
Børge Warvik

Peter Putzer

Wednesday 02 May 2007 8:49:19 am

Done. The extension is available at http://ez.no/community/contribs/template_plugins/lucene_score_sorting

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

Paul Borgermans

Wednesday 02 May 2007 10:55:46 am

Hi Børge

What's the problem here? Results are sorted by score by default.
Or is it with multiple sorting criteria?

Regards
Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Peter Putzer

Wednesday 02 May 2007 2:01:49 pm

It's not if you use <i>subtree_array</i> to include only certain parts of the site in the search.

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

Paul Borgermans

Wednesday 02 May 2007 2:26:56 pm

OK, a very quick review of the code did not yield the culprit, no time to look closer now, but this is a bug.

I'll check later when I've more time.

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Børge Warvik

Thursday 03 May 2007 3:32:25 am

Hi Paul,

It's my mistake. I didn't know that no sorting attribute in the fetch statement would give this sorting... my bad :) Couldn't find anything about that reading the comments... but I've probably just missed it.

Børge