lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trey Grainger (JIRA)" <>
Subject [jira] [Commented] (SOLR-5524) Exception when using Query Function inside Scale Function
Date Tue, 03 Dec 2013 04:32:40 GMT


Trey Grainger commented on SOLR-5524:

I just debugged the code and uncovered the problem.  There is a Map (called context) that
is passed through to each value source to store intermediate state, and both the query and
scale functions are passing the ValueSource for the query function in as the KEY to this Map
(as opposed to using some composite key that makes sense in the current context).  Essentially,
these lines are overwriting each other:

Inside ScaleFloatFunction: context.put(this.source, scaleInfo);  //this.source refers to the
QueryValueSource, and the scaleInfo refers to a ScaleInfo object
Inside QueryValueSource: context.put(this, w); //this refers to the same QueryValueSource
from above, and the w refers to a Weight object

As such, when the ScaleFloatFunction later goes to read the ScaleInfo from the context Map,
it unexpectedly pulls the Weight object out instead and thus the invalid case exception occurs.
 The NoOp multiplication works because it puts an "different" ValueSource between the query
and the ScaleFloatFunction such that this.source (in ScaleFloatFunction) != this (in QueryValueSource).

> Exception when using Query Function inside Scale Function
> ---------------------------------------------------------
>                 Key: SOLR-5524
>                 URL:
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 4.6
>            Reporter: Trey Grainger
>            Priority: Minor
>             Fix For: 4.7
> If you try to use the query function inside the scale function, it throws the following
>$BooleanWeight cannot be cast to
> org.apache.lucene.queries.function.valuesource.ScaleFloatFunction$ScaleInfo
> Here is an example request that invokes this:
> http://localhost:8983/solr/collection1/select?q=*:*&fl=scale(query($x),0,5)&x=hello)

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message