Mulitiple sort_by fields

|
|
Next topic
 »
Author Message

Steven E. Bailey

Tuesday 14 June 2011 2:00:54 am

According to the documentation http://doc.ez.no/Extensions/eZ-Publish-extensions/eZ-Find/eZ-Find-2.3/Customization/Template-fetch-functions, I can use multiple sort_by fields:

<span class="line">fetch( ezfind, search, hash( query, 'eZ Systems', sort_by,</span>
<span class="line">hash( class_name, asc, published, desc ) ) )</span>

But if I use 'sort_by', hash(  'score', 'desc' ) - it works as expected,

and 'sort_by', hash( 'published', 'desc' ) - also works as expected,

But,

'sort_by', hash(  'score', 'desc', 'published', 'desc' ),

Sorts by score for me but the published dates are seemingly random.

Does this work for other people (version 2.3), am I doing something wrong, or is this a bug?

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Steven E. Bailey

Wednesday 10 August 2011 12:55:34 am

Anyone?

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Steven E. Bailey

Wednesday 10 August 2011 4:30:06 am

Added an issue:

http://issues.ez.no/IssueView.php?Id=18536&activeItem=1

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Paul Borgermans

Monday 15 August 2011 5:27:43 am

Hi Steven

 

As I commented in the issue tracker, this is actually not a bug: sorting is done by Solr, and trying to use anything else as a second scoring option will likely fail. The score is a float when Solr computes it, and the likelihood that two values in the result list will be identical is very small.

But I have the feeling you want to do something else: boost more recent documents perhaps?

 

hth

Paul

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

Steven E. Bailey

Monday 15 August 2011 8:43:19 am

Yeah I figured as much as far as a bug goes - it really working as expected although it's always going to have the weird effect when sorting with score and something else.

I don't think boosting will help - all that will do is change the score, right?  It's really only that a customer noticed because they wanted a list of documents by score and then noticed the dates were random and asked if we could sort by date too.  Maybe a caveat should be added to the documentation where it describes how to sort by multiple parameters.

I suppose there's no way to trick solr into storing the score as a int when indexing?

I just googled this and came up a bunch of people asking the same thing for solr going back until 2008 with no good asnwers.

You may as well close the bug and call it a feature.  Although it would be nice to document it somewhere other than here.

 

 

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

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 02:04:54
Script start
Timing: Jan 18 2025 02:04:54
Module start 'layout'
Timing: Jan 18 2025 02:04:54
Module start 'content'
Timing: Jan 18 2025 02:04:56
Module end 'content'
Timing: Jan 18 2025 02:04:56
Script end

Main resources:

Total runtime1.2206 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 589.0156153.4531
Module start 'layout' 0.00650.0035 742.468839.3984
Module start 'content' 0.01011.2089 781.8672576.7422
Module end 'content' 1.21890.0017 1,358.609416.1563
Script end 1.2206  1,374.7656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.2586160.0002
Check MTime0.00140.1117160.0001
Mysql Total
Database connection0.00080.063710.0008
Mysqli_queries1.155794.6837630.0183
Looping result0.00060.0490600.0000
Template Total1.168895.820.5844
Template load0.00200.167620.0010
Template processing1.166795.581520.5833
Template load and register function0.00010.008110.0001
states
state_id_array0.00250.202710.0025
state_identifier_array0.00210.172620.0011
Override
Cache load0.00170.1377380.0000
Sytem overhead
Fetch class attribute can translate value0.00050.045020.0003
Fetch class attribute name0.00110.088270.0002
XML
Image XML parsing0.00110.087420.0005
class_abstraction
Instantiating content class attribute0.00000.0017100.0000
General
dbfile0.00120.0987240.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs