[ https://issues.apache.org/jira/browse/LUCENE-8908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16887518#comment-16887518 ]
Hoss Man commented on LUCENE-8908: ---------------------------------- [~munendrasn] at first glance this looks good ... but i'm wondering if this actually fixes all of the examples i mentioned when this was opened -- in particular things like {{exists(query($qx,0))}} vs {{exists(query($qx))}} ... those should return different things depending on whether the doc matches $qx or not. IIRC that would require modifying QueryDocValues.exists() to return "true" anytime there is a defVal, but i don't think that's really possible ATM because it's a {float}} (not a nullable Float) ... and i'm not sure off the top of my head that it would even be the ideal behavior for the QueryDocValues code ? ... maybe the solr ValueSourceParser logic should be changed to put an explicit wrapper around the QueryValueSource when a default is (isn't?) used ... not sure, i haven't looked / thought about this code in a long time. > Specified default value not returned for query() when doc doesn't match > ----------------------------------------------------------------------- > > Key: LUCENE-8908 > URL: https://issues.apache.org/jira/browse/LUCENE-8908 > Project: Lucene - Core > Issue Type: Bug > Reporter: Bill Bell > Priority: Major > Attachments: LUCENE-8908.patch, SOLR-7845.patch, SOLR-7845.patch > > > The 2 arg version of the "query()" was designed so that the second argument > would specify the value used for any document that does not match the query > pecified by the first argument -- but the "exists" property of the resulting > ValueSource only takes into consideration wether or not the document matches > the query -- and ignores the use of the second argument. > ---- > The work around is to ignore the 2 arg form of the query() function, and > instead wrap he query function in def(). > for example: {{def(query($something), $defaultval)}} instead of > {{query($something, $defaultval)}} -- This message was sent by Atlassian JIRA (v7.6.14#76016) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org