MetaFieldRanker
: allow different options for what to do with missing metadata field
#7691
Labels
MetaFieldRanker
: allow different options for what to do with missing metadata field
#7691
Is your feature request related to a problem? Please describe.
This is not an immediately faced problem, but seems like something that would be undesired in the long run. Long story short, currently when
MetaFieldRanker
sorts by the assigned metadata field, it puts any documents that are missing that metadata field at the bottom of that sort (assuming there is at least one doc that does have that metadata field). So e.g. if sorting by a date metadata field in descending order, docs without that metadata field are treated as chronologically prior to all docs with that metadata field. This may not be the desired way to handle this situation in all use cases.Describe the solution you'd like
I think it'd make sense to have a parameter like
missing_meta: Literal["bottom", "top", "drop"] = "bottom"
, which determines what to do with documents that are missing the sort metadata field."bottom"
(default): documents with missing metadata field are sorted at bottom when sorting for that metadata field (currently-exhibited behavior)."top"
: documents with missing metadata field are sorted at top when sorting for that metadata field."drop"
: documents with missing metadata field are dropped entirely.I'm certainly open to alternatives, but these seemed to me to be the three most obvious options.
Describe alternatives you've considered
Haven't seriously considered other options. The next best thing as far as I can tell would be to introduce an additional component that does some filtering or re-ranking, so that way
MetaFieldRanker
stays intact but these alternative options are achievable. This seems to me to be a worse option, however.Additional context
I'd love to take this on myself.
The text was updated successfully, but these errors were encountered: