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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 15:07:00
Script start
Timing: Jan 18 2025 15:07:00
Module start 'layout'
Timing: Jan 18 2025 15:07:00
Module start 'content'
Timing: Jan 18 2025 15:07:00
Module end 'content'
Timing: Jan 18 2025 15:07:00
Script end

Main resources:

Total runtime0.0181 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0069 587.9141152.6250
Module start 'layout' 0.00690.0037 740.539139.4453
Module start 'content' 0.01070.0054 779.984497.3359
Module end 'content' 0.01600.0021 877.320342.3047
Script end 0.0181  919.6250 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002815.6611140.0002
Check MTime0.00137.3187140.0001
Mysql Total
Database connection0.00137.130810.0013
Mysqli_queries0.003820.731630.0013
Looping result0.00000.099910.0000
Template Total0.00179.410.0017
Template load0.00095.069210.0009
Template processing0.00084.309810.0008
Override
Cache load0.00073.604210.0007
General
dbfile0.00031.926380.0000
String conversion0.00000.049940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs