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

Tim Kornhammar commented on SOLR-3667:
--------------------------------------

I've searched a lot for that information and all I needed where the keyword 
lossy...

If it isn't a bug, how come the score can be a float with precision but the 
boost which would be a part of the score cannot?

Also the docs about encodeNormValue() says "The encoding uses a three-bit 
mantissa, a five-bit exponent, and the zero-exponent point at 15, thus 
representing values from around 7x10^9 to 2x10^-9 with about one significant 
decimal digit of accuracy." so how is it lossy?


My current solution is to use:
bq. q={!boost b=ranking}keyword:test

And by letting computeNorm() return 1.

But that should lead be a performance loss, to change the scoring at search 
time so not really the best solution..?
                
> Solr::fieldNorm() gives weired values with CustomSimilarity.
> ------------------------------------------------------------
>
>                 Key: SOLR-3667
>                 URL: https://issues.apache.org/jira/browse/SOLR-3667
>             Project: Solr
>          Issue Type: Bug
>          Components: update
>    Affects Versions: 3.6
>         Environment: Ubuntu 12.04
>            Reporter: Tim Kornhammar
>
> I have only seen floats being "smaller" int values like "13.33" becoming 
> "12.00", it is a very strange behavior. It behaves the same if the boost is 
> on the keyword field...
> Example of update data:
> {code:xml|borderStyle=solid}
> <add>
>       <doc boost="13.33">
>               <field name="keyword">test one</field>
>               <field name="ranking">13.33</field>
>       </doc>
>       <doc boost="10.00">
>               <field name="keyword">test two</field>
>               <field name="ranking">10.00</field>
>       </doc>
> </add>
> {code}
> Example of solr response, ranking is what I have tried to give both the 
> document boost and field boost individualy.
> {code:xml|borderStyle=solid}
> <result>
>       <doc>
>               <float name="score">12.0</float>
>               <str name="keyword">test one</str>
>               <float name="ranking">12.0</float>
>       </doc>
>       <doc>
>               <float name="score">10.0</float>
>               <str name="keyword">test two</str>
>               <float name="ranking">10.0</float>
>       </doc>
> </result>
> <lst name="debug">
>       <lst name="explain">
>               <str name="1">
>               12.0 = (MATCH) fieldWeight(keyword:test in 0), product of:
>                 1.0 = tf(termFreq(keyword:test)=1)
>                 1.0 = idf(docFreq=2, maxDocs=2)
>                 12.0 = fieldNorm(field=keyword, doc=0)
>               </str>
>               <str name="2">
>               10.0 = (MATCH) fieldWeight(keyword:test in 0), product of:
>                 1.0 = tf(termFreq(keyword:test)=1)
>                 1.0 = idf(docFreq=2, maxDocs=2)
>                 10.0 = fieldNorm(field=keyword, doc=0)
>               </str>
>       </lst>
> </lst>
> {code}
> My CustomSimilarity class:
> {code:title=CustomSimilarity.java|borderStyle=solid}
> import org.apache.lucene.index.FieldInvertState;
> import org.apache.lucene.search.DefaultSimilarity;
> public class CustomSimilarity extends DefaultSimilarity {
>       public CustomSimilarity() {
>               super();
>       }
>       public float tf(int freq) {
>               return (float) 1.0;
>       }
>       public float idf(int docFreq, int numDocs) {
>               return (float) 1.0;
>       }
>       public float computeNorm(String field, FieldInvertState state) {
>               return state.getBoost();
>       }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to