[
https://issues.apache.org/jira/browse/LUCENE-3440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13113389#comment-13113389
]
S.L. edited comment on LUCENE-3440 at 9/23/11 12:56 PM:
--------------------------------------------------------
Hi Koji,
bq. 1. Which patch do you want me to try?
Doesn't matter. First time I took the trunk for a long time. I'm looking
forward to the new admin-interface in solr/lucene-4.0!
bq. 2. Can you make that for trunk branch?
Here we go. This Version is slightly different, the weight is now boosted by
the normalized number of terms per fragment:
{code:borderStyle=dotted}
for( WeightedPhraseInfo phraseInfo : phraseInfoList ){
SubInfo subInfo = new SubInfo( phraseInfo.text, phraseInfo.termsOffsets,
phraseInfo.seqnum );
subInfos.add( subInfo );
Iterator it = phraseInfo.termInfos.iterator();
TermInfo ti;
totalBoost += phraseInfo.boost;
while ( it.hasNext() ) {
ti = ( TermInfo ) it.next();
if ( uniqueTerms.add( ti.text ) )
totalWeight += Math.pow(ti.weight, 2) * phraseInfo.boost;
termsPerFrag++;
}
}
}
totalWeight *= termsPerFrag * ( 1 / Math.sqrt( termsPerFrag ) );
{code}
Due to a significant lack of mathematical knowledge, a *very* _intuitive_
solution.
But it seems to work very well, at least for our data (highly multi-lingual,
mostly historical, dirty OCRed, books, journals + papers).
was (Author: mdz-munich):
Hi Koji,
bq. 1. Which patch do you want me to try?
Doesn't matter. First time I took the trunk for a long time. I'm looking
forward to the new admin-interface in solr/lucene-4.0!
bq. 2. Can you make that for trunk branch?
Here we go. This Version is slightly different, the weight is now boosted by
the normalized number of terms per fragment:
{code:borderStyle=dotted}
for( WeightedPhraseInfo phraseInfo : phraseInfoList ){
SubInfo subInfo = new SubInfo( phraseInfo.text, phraseInfo.termsOffsets,
phraseInfo.seqnum );
subInfos.add( subInfo );
Iterator it = phraseInfo.termInfos.iterator();
TermInfo ti;
totalBoost += phraseInfo.boost;
while ( it.hasNext() ) {
ti = ( TermInfo ) it.next();
if ( uniqueTerms.add( ti.text ) )
totalWeight += Math.pow(ti.weight, 2) * phraseInfo.boost;
termsPerFrag++;
}
}
totalWeight *= termsPerFrag * ( 1 / Math.sqrt( termsPerFrag ) );
}
{code}
Due to a significant lack of mathematical knowledge, a *very* _intuitive_
solution.
But it seems to work very well, at least for our data (highly multi-lingual,
mostly historical, dirty OCRed, books, journals + papers).
> FastVectorHighlighter: IDF-weighted terms for ordered fragments
> ----------------------------------------------------------------
>
> Key: LUCENE-3440
> URL: https://issues.apache.org/jira/browse/LUCENE-3440
> Project: Lucene - Java
> Issue Type: Improvement
> Components: modules/highlighter
> Affects Versions: 3.5
> Reporter: S.L.
> Priority: Minor
> Labels: FastVectorHighlighter
> Fix For: 3.5
>
> Attachments: LUCENE-3.5-SNAPSHOT-3440-3.patch,
> LUCENE-4.0-SNAPSHOT-3440-3.patch
>
>
> The FastVectorHighlighter uses for every term found in a fragment an equal
> weight, which causes a higher ranking for fragments with a high number of
> words or, in the worst case, a high number of very common words than
> fragments that contains *all* of the terms used in the original query.
> This patch provides ordered fragments with IDF-weighted terms:
> total weight = total weight + IDF for unique term per fragment * boost of
> query;
> The ranking-formula should be the same, or at least similar, to that one used
> in org.apache.lucene.search.highlight.QueryTermScorer.
> The patch is simple, but it works for us.
> Some ideas:
> - A better approach would be moving the whole fragments-scoring into a
> separate class.
> - Switch scoring via parameter
> - Exact phrases should be given a even better score, regardless if a
> phrase-query was executed or not
> - edismax/dismax-parameters pf, ps and pf^boost should be observed and
> corresponding fragments should be ranked higher
--
This message is automatically generated by JIRA.
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]