eZ Community » Forums » Extensions » eZ Find » Mulitiple sort_by fields
expandshrink

Mulitiple sort_by fields

Mulitiple sort_by fields

Tuesday 14 June 2011 11:00:54 am - 4 replies

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?

Modified on Tuesday 14 June 2011 11:02:13 am by Steven E Bailey

Wednesday 10 August 2011 9:55:34 am

Anyone?

Wednesday 10 August 2011 1:30:06 pm

Added an issue:

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

Monday 15 August 2011 2:27:43 pm

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

Monday 15 August 2011 5:43:19 pm

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.

 

 

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from