You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Vincenzo D'Amore <v....@gmail.com> on 2018/10/17 23:06:55 UTC

Constant Score

Hi all,

I tried to use constant score into qf parameter but I had an exception.
Is this normal? The qf parameter actually is something like this:

field1^3 field2^4 field3^5... etc.

Because it's a query for an ecommerce website I don't want that the results
are influenced by tf/idf.

Is there any chance to avoid this behaviour? Thanks in advance.
Vincenzo

The exception raised

<?xml version="1.0" encoding="UTF-8"?>
<response>

<lst name="responseHeader">
  <bool name="zkConnected">true</bool>
  <int name="status">500</int>
  <int name="QTime">1</int>
</lst>
<lst name="error">
  <str name="msg">For input string: "=3"</str>
  <str name="trace">java.lang.NumberFormatException: For input string: "=3"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseFloat(FloatingDecimal.java:122)
at java.lang.Float.parseFloat(Float.java:451)
at java.lang.Float.valueOf(Float.java:416)
at
org.apache.solr.util.SolrPluginUtils.parseFieldBoosts(SolrPluginUtils.java:540)
at
org.apache.solr.search.DisMaxQParser.parseQueryFields(DisMaxQParser.java:71)
at
org.apache.solr.search.ExtendedDismaxQParser$ExtendedDismaxConfiguration.&lt;init&gt;(ExtendedDismaxQParser.java:1608)
at
org.apache.solr.search.ExtendedDismaxQParser.createConfiguration(ExtendedDismaxQParser.java:256)
at
org.apache.solr.search.ExtendedDismaxQParser.&lt;init&gt;(ExtendedDismaxQParser.java:115)
at
org.apache.solr.search.ExtendedDismaxQParserPlugin.createParser(ExtendedDismaxQParserPlugin.java:31)


-- 
Vincenzo D'Amore

Re: Constant Score

Posted by Shawn Heisey <ap...@elyograg.org>.
On 10/17/2018 5:06 PM, Vincenzo D'Amore wrote:
> I tried to use constant score into qf parameter but I had an exception.
> Is this normal? The qf parameter actually is something like this:
>
> field1^3 field2^4 field3^5... etc.

You didn't actually say, but it sounds like you're trying to use 
"field^=3" in your qf parameter.  I did a test query with this on a 7.5 
example and saw the same exception.

I'm betting that qf does not support the constant score boost option.  
It's not mentioned as possible in the documentation.  I have no idea how 
difficult it would be to add that support.  Opening an enhancement issue 
in Jira is probably a good idea.

> Because it's a query for an ecommerce website I don't want that the results
> are influenced by tf/idf.

If you really don't want something to affect relevancy ranking, put it 
in a filter query.  Filter queries do not affect the score.

fq={!edismax qf="field1 field2"}XXXX

Where XXXX is the query text.  I tried that syntax out, and the parsed 
query looks like it did exactly what I expected.

Thanks,
Shawn