[jira] [Comment Edited] (SOLR-1485) Payload scoring support

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[jira] [Comment Edited] (SOLR-1485) Payload scoring support

JIRA jira@apache.org

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

Erik Hatcher edited comment on SOLR-1485 at 4/21/17 12:21 PM:
--------------------------------------------------------------

It's interesting to note that there is actually one query built in that could handle payload scoring already: {{q=\{!xmlparser}<BoostingTermQuery fieldName="weighted_terms_dpf">weighted</BoostingTermQuery>}}, with hardcoded "average" function and includeSpanScore=true, resulting in the above data example an output of:
{code}
id,score
2,71.00154
{code}

And here's a patch that adds includeSpanScore control flexibility to {{<BoostingTermQuery>}}:

{code}
--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/BoostingTermBuilder.java
+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/BoostingTermBuilder.java
@@ -34,11 +34,12 @@ public class BoostingTermBuilder extends SpanBuilderBase {
   @Override
   public SpanQuery getSpanQuery(Element e) throws ParserException {
     String fieldName = DOMUtils.getAttributeWithInheritanceOrFail(e, "fieldName");
+    boolean includeSpanQuery = DOMUtils.getAttribute(e, "includeSpanScore", true);
     String value = DOMUtils.getNonBlankTextOrFail(e);
 
-    // TODO: add parameter to control PayloadScoreQuery's `includeSpanScore` and `PayloadFunction`
+    // TODO: add parameter to control PayloadScoreQuery's and `PayloadFunction`
     SpanQuery btq = new PayloadScoreQuery(new SpanTermQuery(new Term(fieldName, value)),
-        new AveragePayloadFunction());
+        new AveragePayloadFunction(), includeSpanQuery);
     btq = new SpanBoostQuery(btq, DOMUtils.getAttribute(e, "boost", 1.0f));
     return btq;
   }
{code}



was (Author: ehatcher):
It's interesting to note that there is actually one query built in that could handle payload scoring already: {{q=\{!xmlparser}<BoostingTermQuery fieldName="weighted_terms_dpf">weighted</BoostingTermQuery>}}, with hardcoded "average" function and includeSpanScore=true, resulting in the above data example an output of:
{code}
id,score
2,71.00154
{code}

> Payload scoring support
> -----------------------
>
>                 Key: SOLR-1485
>                 URL: https://issues.apache.org/jira/browse/SOLR-1485
>             Project: Solr
>          Issue Type: New Feature
>          Components: search
>            Reporter: Erik Hatcher
>            Assignee: Erik Hatcher
>            Priority: Minor
>             Fix For: master (7.0)
>
>         Attachments: PayloadTermQueryPlugin.java, payload_value_source.png, SOLR-1485.patch, SOLR-1485.patch, SOLR-1485.patch, SOLR-1485.patch, SOLR-1485.patch
>
>
> Solr has no support for Lucene's PayloadScoreQuery, yet it has support for indexing payloads (via DelimitedPayloadTokenFilter or NumericPayloadTokenFilter).
> This issue adds value source and query parser support for leveraging payloads created by those token filters.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Loading...