[ 
https://issues.apache.org/jira/browse/SOLR-8264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14997376#comment-14997376
 ] 

Hoss Man commented on SOLR-8264:
--------------------------------

This sounds like the correct behavior since Lucene/Solr 5.0 fixed bugs in 
several value sources.

As noted in the 5.0 upgrade instructions...

{noformat}
* Bugs fixed in several ValueSource functions may result in different behavior 
in 
  situations where some documents do not have values for fields wrapped in 
other value 
  sources.  Users who want to preserve the previous behavior may need to wrap 
fields
  in the "def()" function. Example: changing "fl=sum(fieldA,fieldB)" to 
  "fl=sum(def(fieldA,0.0),def(fieldB,0.0))".  See LUCENE-5961 for more details.
{noformat}

bq. And so the following boost works even though date_s doesn't exist for the 
particular record:

...that's because when not wrapped in a function like min or max, recip 
(wrapping ms) gives you a "fake" value based on the implicit assumption that a 
missing value should be treated a certain way ... but the "exists/missing" 
metadata is propagated up, and min/max know to choose "real" values when 
available.

Wrapping your "ms" in a "def()" call with a default of "0" should give you what 
you're looking for.

> Date boosting losing to constant value in min function when date value is null
> ------------------------------------------------------------------------------
>
>                 Key: SOLR-8264
>                 URL: https://issues.apache.org/jira/browse/SOLR-8264
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 5.3
>            Reporter: Charles Draper
>            Priority: Minor
>
> I am following https://wiki.apache.org/solr/FunctionQuery#Date_Boosting for 
> date boosting. This works great except when the date field is non-existent 
> and I attempt to set a maximum value. As I understand it, a non-existent date 
> field will default to the start of the epoch for functions. And so the 
> following boost works even though date_s doesn't exist for the particular 
> record:
> {code}
> recip(ms(NOW/YEAR,date_s),3.16e-11,1,1)
> 0.021798734 = 
> 1.0/(3.16E-11*float(ms(const(1420070400000),date(date_s)=null))+1.0)
> {code}
> However, when I try to apply a min function, the constant value is always 
> selected whether it is greater or less than the recip calculation: 
> {code}
> min(1,recip(ms(NOW/YEAR,date_s),3.16e-11,1,1))
> 1.0 = 
> min(const(1),1.0/(3.16E-11*float(ms(const(1420070400000),date(date_s)=null))+1.0))
> {code}
> I am currently getting around the issue by supplying a default value for the 
> field in my schema.xml.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to