You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Yonik Seeley <yo...@lucidimagination.com> on 2011/03/03 00:15:16 UTC
sortMissingLast
It occurs to me that not being able to specify
sortMissingLast/sortMissingFirst on a per-sort basis is kind of silly
(in Solr).
So - the big question is... what kind of syntax should we use to support this?
The easiest to implement would probably be to use different sort
direction strings...
sort=myfield asc (a normal ascending sort)
sort=myfield asc_ml (an ascending sort with docs with missing
values appearing last)
Thoughts?
-Yonik
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
Re: sortMissingLast
Posted by Chris Hostetter <ho...@fucit.org>.
: It occurs to me that not being able to specify
: sortMissingLast/sortMissingFirst on a per-sort basis is kind of silly
: (in Solr).
: So - the big question is... what kind of syntax should we use to support this?
personally i'm of the opinion that this is something that makes sense
dictated by the config, not something that should be runtime controlled
(just like you shouldn't be able to say "sort this int field
lexigraphically") .. the person defining the schema should make these
decisions.
that said, if we are going to support it...
: The easiest to implement would probably be to use different sort
: direction strings...
: sort=myfield asc (a normal ascending sort)
: sort=myfield asc_ml (an ascending sort with docs with missing
: values appearing last)
:
: Thoughts?
except then you have to worry about the people trying to mix/match
"asc_ml" with function sorting -- and what would it mean to say "score
asc_mf"
I think a cleaner way might be to add a mapping function specificly for
dealing with non-existant values (something that would be generally
valuable: a "mapMissing" option on the FieldCacheValueSources) that also
lets you use some sort of shorthand for "map missing to min possible" or
"map missing to max possible" and then use sort by function.
the sort parser can optimize away the actaul "sort by ValueSource" if it
sees that the ValueSource is just a FieldCache backed valuesource, and
using hte appropariate sort missing logic.
general func: missing(fieldName,value)
simple example: missing(price,42)
special syntax for min legal value: missing(price,min)
special syntax for max legal value: missing(price,max)
used in a sort to force sort missing last...
sort=missing(price,min) desc
sort=missing(price,max) asc
-Hoss
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org