I opened https://issues.apache.org/jira/browse/LUCENE-6844

Alan Woodward
www.flax.co.uk


On 19 Oct 2015, at 08:49, Alan Woodward wrote:

> Hi Bill,
> 
> This looks like an oversight on my part when migrating the payload scoring 
> queries - can you open a JIRA ticket to add 'includeSpanScore' as an option 
> to PayloadScoreQuery?
> 
> As a workaround, you should be able to use a custom similarity that returns 1 
> for all scores (see IndexSearcher.NON_SCORING_SIMILARITY for an 
> implementation that returns 0, you could just clone that and change 
> SimScorer.score())
> 
> Alan Woodward
> www.flax.co.uk
> 
> 
> On 19 Oct 2015, at 00:39, William Bell wrote:
> 
>> Here is my first stab at it. Thoughts?
>> 
>> Question:
>> 
>> new PayloadTermQuery(new Term(nv[0].substring(1), nv[1]), new
>> AveragePayloadFunction(), false)
>> 
>> How do I handle the "false"  ? It means boolean includeSpanScore
>> 
>> 
>> @Override
>> public Query parse() throws SyntaxError {
>> 
>>    if (qstr == null || qstr.length() == 0) return null;
>>    //BooleanQuery q = new BooleanQuery();
>>    BooleanQuery.Builder q = new BooleanQuery.Builder();
>>    q.setDisableCoord(true);
>>    if (qstr.length() > 1 && qstr.startsWith("\"") && qstr.endsWith("\"")) {
>>        qstr = qstr.substring(1,qstr.length()-1);
>>    }
>>    String[] nvps = StringUtils.split(qstr, " ");
>>    for (int i = 0; i < nvps.length; i++) {
>>        String[] nv = StringUtils.split(nvps[i], ":");
>>        if (nv.length > 1) {
>>          if (nv[0].startsWith("+")) {
>>              SpanTermQuery sq = new SpanTermQuery(new
>> Term(nv[0].substring(1), nv[1]));
>>              PayloadScoreQuery psq = new PayloadScoreQuery(sq, new
>> AveragePayloadFunction());
>>              q.add(psq, Occur.MUST);
>>            //q.add(new PayloadTermQuery(new Term(nv[0].substring(1),
>> nv[1]), new AveragePayloadFunction(), false), Occur.MUST);
>>          } else {
>>            //q.add(new PayloadTermQuery(new Term(nv[0], nv[1]), new
>> AveragePayloadFunction(), false), Occur.SHOULD);
>>              SpanTermQuery sq = new SpanTermQuery(new Term(nv[0], nv[1]));
>>              PayloadScoreQuery psq = new PayloadScoreQuery(sq, new
>> AveragePayloadFunction());
>>              q.add(psq, Occur.SHOULD);
>>          }
>>        }
>>    }
>>    // return q;
>>    return q.build();
>> }
>> 
>> 
>> On Sun, Oct 18, 2015 at 4:46 PM, William Bell <billnb...@gmail.com> wrote:
>> 
>>> Wondering how to change my payload based on example:
>>> 
>>> https://lucidworks.com/blog/2014/06/13/end-to-end-payload-example-in-solr/
>>> 
>>> PayloadTermQuery and BooleanQuery are deprecated in 5.3.x
>>> 
>>> @Override
>>> public Query parse() throws SyntaxError {
>>> 
>>>    if (qstr == null || qstr.length() == 0) return null;
>>>    BooleanQuery q = new BooleanQuery();
>>>    if (qstr.length() > 1 && qstr.startsWith("\"") && qstr.endsWith("\"")) {
>>>        qstr = qstr.substring(1,qstr.length()-1);
>>>    }
>>>    String[] nvps = StringUtils.split(qstr, " ");
>>>    for (int i = 0; i < nvps.length; i++) {
>>>        String[] nv = StringUtils.split(nvps[i], ":");
>>>        if (nv.length > 1) {
>>>          if (nv[0].startsWith("+")) {
>>>            q.add(new PayloadTermQuery(new Term(nv[0].substring(1), nv[1]),
>>>              new AveragePayloadFunction(), false), Occur.MUST);
>>>          } else {
>>>            q.add(new PayloadTermQuery(new Term(nv[0], nv[1]),
>>>              new AveragePayloadFunction(), false), Occur.SHOULD);
>>>          }
>>>        }
>>>    }
>>>    return q;
>>> }
>>> 
>>> 
>>> --
>>> Bill Bell
>>> billnb...@gmail.com
>>> cell 720-256-8076
>>> 
>> 
>> 
>> 
>> -- 
>> Bill Bell
>> billnb...@gmail.com
>> cell 720-256-8076
> 

Reply via email to