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

koji edited comment on SOLR-517 at 8/11/08 9:27 PM:
--------------------------------------------------------------

Ok, I provided a Lucene program (TestNegativeIdf.java) to show negative idf.

To see negative idf, do not optimize() (do not uncomment the following line):

{code}
static void deleteDocument() throws IOException {
    IndexWriter writer = new IndexWriter( dir, analyzer, false, 
MaxFieldLength.LIMITED );
    writer.deleteDocuments( new Term( "t_text1", "del" ) );
    // To see negative idf, keep comment the following line
    //writer.optimize();
    writer.close();
}
{code}

You'll get a null fragment due to negative idf. Easiest way to avoid negative 
idf, switch the scorer:

{code}
// This scorer can return negative idf -> null fragment
Scorer scorer = new QueryScorer( query, searcher.getIndexReader(), "t_text1" );
// This scorer doesn't use idf (patch version)
//Scorer scorer = new QueryScorer( query, "t_text1" );
{code}


      was (Author: koji):
    Ok, I provided a Lucene program to show negative idf.

To see negative idf, do not optimize() (do not uncomment the following line):

{code}
  static void deleteDocument() throws IOException {
    IndexWriter writer = new IndexWriter( dir, analyzer, false, 
MaxFieldLength.LIMITED );
    writer.deleteDocuments( new Term( "t_text1", "del" ) );
    // To see negative idf, keep comment the following line
    //writer.optimize();
    writer.close();
  }
{code}

You'll get a null fragment due to negative idf. Easiest way to avoid negative 
idf, switch the scorer:

{code}
    // This scorer can return negative idf -> null fragment
    Scorer scorer = new QueryScorer( query, searcher.getIndexReader(), 
"t_text1" );
    // This scorer doesn't use idf (patch version)
    //Scorer scorer = new QueryScorer( query, "t_text1" );
{code}

  
> highlighter doesn't work with hl.requireFieldMatch=true on un-optimized index
> -----------------------------------------------------------------------------
>
>                 Key: SOLR-517
>                 URL: https://issues.apache.org/jira/browse/SOLR-517
>             Project: Solr
>          Issue Type: Bug
>          Components: highlighter
>    Affects Versions: 1.2, 1.3
>            Reporter: Koji Sekiguchi
>            Priority: Minor
>         Attachments: SOLR-517.patch, SOLR-517.patch, SOLR-517.patch, 
> TestNegativeIdf.java
>
>
> On un-optimized index, highlighter doesn't work with 
> hl.requireFieldMatch=true.
> see:
> http://www.nabble.com/hl.requireFieldMatch-and-idf-td16324482.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to