Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 983E418DD0 for ; Mon, 9 Nov 2015 21:22:12 +0000 (UTC) Received: (qmail 24044 invoked by uid 500); 9 Nov 2015 21:22:11 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 23984 invoked by uid 500); 9 Nov 2015 21:22:11 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 23946 invoked by uid 99); 9 Nov 2015 21:22:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Nov 2015 21:22:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 1BB672C1F5A for ; Mon, 9 Nov 2015 21:22:11 +0000 (UTC) Date: Mon, 9 Nov 2015 21:22:11 +0000 (UTC) From: "Hoss Man (JIRA)" To: dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SOLR-8264) Date boosting losing to constant value in min function when date value is null MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org