lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (SOLR-3667) Solr::fieldNorm() gives weired values with CustomSimilarity.
Date Tue, 24 Jul 2012 12:29:34 GMT

     [ https://issues.apache.org/jira/browse/SOLR-3667?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Robert Muir resolved SOLR-3667.
-------------------------------

    Resolution: Not A Problem

please see the documentation on norms on the lucene website: they are lossy.
                
> 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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message