You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Adam Ringel (JIRA)" <ji...@apache.org> on 2013/06/18 14:15:20 UTC

[jira] [Commented] (LUCENE-2880) SpanQuery scoring inconsistencies

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

Adam Ringel commented on LUCENE-2880:
-------------------------------------

I subclassed DefaultSimilarity to work around this.
Seemed simple enough.

{code}
public class LUCENE2880_SloppyFreqDistanceAdjuster {
	private static Logger logger = Logger.getLogger(LUCENE2880_SloppyFreqDistanceAdjuster.class);

	public int distance(int distance) {
		if(distance < 2) {
			logger.warn("distance - distacne is <, 2, has LUCENE-2880 been resolved?");
			return 0;
		}

		return distance - 2;
	}

}

public class LUCENE2880_DefaultSimilarity extends DefaultSimilarity {
	private static final long serialVersionUID = 1L;
	private static final LUCENE2880_SloppyFreqDistanceAdjuster ADJUSTER = new LUCENE2880_SloppyFreqDistanceAdjuster();

	@Override
	public float sloppyFreq(int distance) {
		return super.sloppyFreq(ADJUSTER.distance(distance));
	}

}
{code}


                
> SpanQuery scoring inconsistencies
> ---------------------------------
>
>                 Key: LUCENE-2880
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2880
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>             Fix For: 4.4
>
>         Attachments: LUCENE-2880.patch
>
>
> Spinoff of LUCENE-2879.
> You can see a full description there, but the gist is that SpanQuery sums up freqs with "sloppyFreq".
> However this slop is simply spans.end() - spans.start()
> For a SpanTermQuery for example, this means its scoring 0.5 for TF versus TermQuery's 1.0.
> As you can imagine, I think in practical situations this would make it difficult for SpanQuery users to
> really use SpanQueries for effective ranking, especially in combination with non-Spanqueries (maybe via DisjunctionMaxQuery, etc)
> The problem is more general than this simple example: for example SpanNearQuery should be consistent with PhraseQuery's slop.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
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