You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Karl Wettin (JIRA)" <ji...@apache.org> on 2009/02/19 17:26:01 UTC

[jira] Created: (LUCENE-1543) Field specified norms in MatchAllDocumentsScorer

Field specified norms in MatchAllDocumentsScorer 
-------------------------------------------------

                 Key: LUCENE-1543
                 URL: https://issues.apache.org/jira/browse/LUCENE-1543
             Project: Lucene - Java
          Issue Type: Improvement
          Components: Query/Scoring
    Affects Versions: 2.4
            Reporter: Karl Wettin
            Priority: Minor
             Fix For: 2.9
         Attachments: LUCENE-1543.txt

This patch allows for optionally setting a field to use for norms factoring when scoring a MatchingAllDocumentsQuery.

>From the test case:
{code:java}
.
    RAMDirectory dir = new RAMDirectory();
    IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
    iw.setMaxBufferedDocs(2);  // force multi-segment
    addDoc("one", iw, 1f);
    addDoc("two", iw, 20f);
    addDoc("three four", iw, 300f);
    iw.close();

    IndexReader ir = IndexReader.open(dir);
    IndexSearcher is = new IndexSearcher(ir);
    ScoreDoc[] hits;

    // assert with norms scoring turned off

    hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
    assertEquals(3, hits.length);
    assertEquals("one", ir.document(hits[0].doc).get("key"));
    assertEquals("two", ir.document(hits[1].doc).get("key"));
    assertEquals("three four", ir.document(hits[2].doc).get("key"));

    // assert with norms scoring turned on

    MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
    assertEquals(3, hits.length);
//    is.explain(normsQuery, hits[0].doc);
    hits = is.search(normsQuery, null, 1000).scoreDocs;

    assertEquals("three four", ir.document(hits[0].doc).get("key"));    
    assertEquals("two", ir.document(hits[1].doc).get("key"));
    assertEquals("one", ir.document(hits[2].doc).get("key"));
{code}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Assigned: (LUCENE-1543) Field specified norms in MatchAllDocumentsScorer

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1543?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless reassigned LUCENE-1543:
------------------------------------------

    Assignee: Michael McCandless

> Field specified norms in MatchAllDocumentsScorer 
> -------------------------------------------------
>
>                 Key: LUCENE-1543
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Query/Scoring
>    Affects Versions: 2.4
>            Reporter: Karl Wettin
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1543.txt
>
>
> This patch allows for optionally setting a field to use for norms factoring when scoring a MatchingAllDocumentsQuery.
> From the test case:
> {code:java}
> .
>     RAMDirectory dir = new RAMDirectory();
>     IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
>     iw.setMaxBufferedDocs(2);  // force multi-segment
>     addDoc("one", iw, 1f);
>     addDoc("two", iw, 20f);
>     addDoc("three four", iw, 300f);
>     iw.close();
>     IndexReader ir = IndexReader.open(dir);
>     IndexSearcher is = new IndexSearcher(ir);
>     ScoreDoc[] hits;
>     // assert with norms scoring turned off
>     hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
>     assertEquals(3, hits.length);
>     assertEquals("one", ir.document(hits[0].doc).get("key"));
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("three four", ir.document(hits[2].doc).get("key"));
>     // assert with norms scoring turned on
>     MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
>     assertEquals(3, hits.length);
> //    is.explain(normsQuery, hits[0].doc);
>     hits = is.search(normsQuery, null, 1000).scoreDocs;
>     assertEquals("three four", ir.document(hits[0].doc).get("key"));    
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("one", ir.document(hits[2].doc).get("key"));
> {code}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1543) Field specified norms in MatchAllDocumentsScorer

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12683440#action_12683440 ] 

Michael McCandless commented on LUCENE-1543:
--------------------------------------------

bq. This is how I reason: if the feature of norms scoring is available in all other low level queries, than it also makes sense to have it in the low level MatchAllDocumentsQuery

OK I agree.  Since the index would already have norms for the field,
it makes sense to provide a way to tap solely those norms as the basis
for scoring.


> Field specified norms in MatchAllDocumentsScorer 
> -------------------------------------------------
>
>                 Key: LUCENE-1543
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Query/Scoring
>    Affects Versions: 2.4
>            Reporter: Karl Wettin
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1543.txt
>
>
> This patch allows for optionally setting a field to use for norms factoring when scoring a MatchingAllDocumentsQuery.
> From the test case:
> {code:java}
> .
>     RAMDirectory dir = new RAMDirectory();
>     IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
>     iw.setMaxBufferedDocs(2);  // force multi-segment
>     addDoc("one", iw, 1f);
>     addDoc("two", iw, 20f);
>     addDoc("three four", iw, 300f);
>     iw.close();
>     IndexReader ir = IndexReader.open(dir);
>     IndexSearcher is = new IndexSearcher(ir);
>     ScoreDoc[] hits;
>     // assert with norms scoring turned off
>     hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
>     assertEquals(3, hits.length);
>     assertEquals("one", ir.document(hits[0].doc).get("key"));
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("three four", ir.document(hits[2].doc).get("key"));
>     // assert with norms scoring turned on
>     MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
>     assertEquals(3, hits.length);
> //    is.explain(normsQuery, hits[0].doc);
>     hits = is.search(normsQuery, null, 1000).scoreDocs;
>     assertEquals("three four", ir.document(hits[0].doc).get("key"));    
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("one", ir.document(hits[2].doc).get("key"));
> {code}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-1543) Field specified norms in MatchAllDocumentsScorer

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1543?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-1543.
----------------------------------------

    Resolution: Fixed

Thanks Karl!

> Field specified norms in MatchAllDocumentsScorer 
> -------------------------------------------------
>
>                 Key: LUCENE-1543
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Query/Scoring
>    Affects Versions: 2.4
>            Reporter: Karl Wettin
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1543.txt
>
>
> This patch allows for optionally setting a field to use for norms factoring when scoring a MatchingAllDocumentsQuery.
> From the test case:
> {code:java}
> .
>     RAMDirectory dir = new RAMDirectory();
>     IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
>     iw.setMaxBufferedDocs(2);  // force multi-segment
>     addDoc("one", iw, 1f);
>     addDoc("two", iw, 20f);
>     addDoc("three four", iw, 300f);
>     iw.close();
>     IndexReader ir = IndexReader.open(dir);
>     IndexSearcher is = new IndexSearcher(ir);
>     ScoreDoc[] hits;
>     // assert with norms scoring turned off
>     hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
>     assertEquals(3, hits.length);
>     assertEquals("one", ir.document(hits[0].doc).get("key"));
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("three four", ir.document(hits[2].doc).get("key"));
>     // assert with norms scoring turned on
>     MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
>     assertEquals(3, hits.length);
> //    is.explain(normsQuery, hits[0].doc);
>     hits = is.search(normsQuery, null, 1000).scoreDocs;
>     assertEquals("three four", ir.document(hits[0].doc).get("key"));    
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("one", ir.document(hits[2].doc).get("key"));
> {code}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1543) Field specified norms in MatchAllDocumentsScorer

Posted by "Karl Wettin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12683423#action_12683423 ] 

Karl Wettin commented on LUCENE-1543:
-------------------------------------

bq. Karl, is there a reason why a function query can't be used in your situation? It seems like it should work?

I'm sure it would. : ) 

I do however not understand why you think it is a more correct/nice/better/what not solution than to use this patch. This is how I reason: if the feature of norms scoring is available in all other low level queries, than it also makes sense to have it in the low level MatchAllDocumentsQuery

> Field specified norms in MatchAllDocumentsScorer 
> -------------------------------------------------
>
>                 Key: LUCENE-1543
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Query/Scoring
>    Affects Versions: 2.4
>            Reporter: Karl Wettin
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1543.txt
>
>
> This patch allows for optionally setting a field to use for norms factoring when scoring a MatchingAllDocumentsQuery.
> From the test case:
> {code:java}
> .
>     RAMDirectory dir = new RAMDirectory();
>     IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
>     iw.setMaxBufferedDocs(2);  // force multi-segment
>     addDoc("one", iw, 1f);
>     addDoc("two", iw, 20f);
>     addDoc("three four", iw, 300f);
>     iw.close();
>     IndexReader ir = IndexReader.open(dir);
>     IndexSearcher is = new IndexSearcher(ir);
>     ScoreDoc[] hits;
>     // assert with norms scoring turned off
>     hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
>     assertEquals(3, hits.length);
>     assertEquals("one", ir.document(hits[0].doc).get("key"));
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("three four", ir.document(hits[2].doc).get("key"));
>     // assert with norms scoring turned on
>     MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
>     assertEquals(3, hits.length);
> //    is.explain(normsQuery, hits[0].doc);
>     hits = is.search(normsQuery, null, 1000).scoreDocs;
>     assertEquals("three four", ir.document(hits[0].doc).get("key"));    
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("one", ir.document(hits[2].doc).get("key"));
> {code}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1543) Field specified norms in MatchAllDocumentsScorer

Posted by "Karl Wettin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1543?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Karl Wettin updated LUCENE-1543:
--------------------------------

    Attachment: LUCENE-1543.txt

> Field specified norms in MatchAllDocumentsScorer 
> -------------------------------------------------
>
>                 Key: LUCENE-1543
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Query/Scoring
>    Affects Versions: 2.4
>            Reporter: Karl Wettin
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1543.txt
>
>
> This patch allows for optionally setting a field to use for norms factoring when scoring a MatchingAllDocumentsQuery.
> From the test case:
> {code:java}
> .
>     RAMDirectory dir = new RAMDirectory();
>     IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
>     iw.setMaxBufferedDocs(2);  // force multi-segment
>     addDoc("one", iw, 1f);
>     addDoc("two", iw, 20f);
>     addDoc("three four", iw, 300f);
>     iw.close();
>     IndexReader ir = IndexReader.open(dir);
>     IndexSearcher is = new IndexSearcher(ir);
>     ScoreDoc[] hits;
>     // assert with norms scoring turned off
>     hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
>     assertEquals(3, hits.length);
>     assertEquals("one", ir.document(hits[0].doc).get("key"));
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("three four", ir.document(hits[2].doc).get("key"));
>     // assert with norms scoring turned on
>     MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
>     assertEquals(3, hits.length);
> //    is.explain(normsQuery, hits[0].doc);
>     hits = is.search(normsQuery, null, 1000).scoreDocs;
>     assertEquals("three four", ir.document(hits[0].doc).get("key"));    
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("one", ir.document(hits[2].doc).get("key"));
> {code}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1543) Field specified norms in MatchAllDocumentsScorer

Posted by "Karl Wettin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675118#action_12675118 ] 

Karl Wettin commented on LUCENE-1543:
-------------------------------------

bq. Couldn't you just use a TermQuery? Or a BooleanQuery with a MatchAllDocsQuery and an optional TermQuery?

Wouldn't that require a TermQuery that match all documents? I.e. adding a term to a field in all documents?

The following stuff doesn't really fit in this issue, but still. It's rather related to column stride payloads LUCENE-1231 . I've been considering adding a new "norms" field at document level for a couple of years now. 8 more bits at document level would allow for moving general document boosting to move it out the norms-boost-per-field-blob and increase the length normalization and per field boost resolution quite a bit at a low cost. 

(I hope that is not yet another can of worms I get to open.)


> Field specified norms in MatchAllDocumentsScorer 
> -------------------------------------------------
>
>                 Key: LUCENE-1543
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Query/Scoring
>    Affects Versions: 2.4
>            Reporter: Karl Wettin
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1543.txt
>
>
> This patch allows for optionally setting a field to use for norms factoring when scoring a MatchingAllDocumentsQuery.
> From the test case:
> {code:java}
> .
>     RAMDirectory dir = new RAMDirectory();
>     IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
>     iw.setMaxBufferedDocs(2);  // force multi-segment
>     addDoc("one", iw, 1f);
>     addDoc("two", iw, 20f);
>     addDoc("three four", iw, 300f);
>     iw.close();
>     IndexReader ir = IndexReader.open(dir);
>     IndexSearcher is = new IndexSearcher(ir);
>     ScoreDoc[] hits;
>     // assert with norms scoring turned off
>     hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
>     assertEquals(3, hits.length);
>     assertEquals("one", ir.document(hits[0].doc).get("key"));
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("three four", ir.document(hits[2].doc).get("key"));
>     // assert with norms scoring turned on
>     MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
>     assertEquals(3, hits.length);
> //    is.explain(normsQuery, hits[0].doc);
>     hits = is.search(normsQuery, null, 1000).scoreDocs;
>     assertEquals("three four", ir.document(hits[0].doc).get("key"));    
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("one", ir.document(hits[2].doc).get("key"));
> {code}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1543) Field specified norms in MatchAllDocumentsScorer

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675570#action_12675570 ] 

Michael McCandless commented on LUCENE-1543:
--------------------------------------------


It seems like this is quite similar to function queries, which also
match all docs but then let you to set your own score for each doc (eg
based on values from FieldCache).

Once we create column-stride fields, and merge norms into it, then
presumably MatchAllDocsQuery & function queries would simply be the
same thing.

bq. I've been considering adding a new "norms" field at document level for a couple of years now. 8 more bits at document level would allow for moving general document boosting to move it out the norms-boost-per-field-blob and increase the length normalization and per field boost resolution quite a bit at a low cost.

This seems interesting -- it would double the precision for boosting,
but would require the equivalent of one more field's norms enabled of
RAM storage (ie a byte[] of length maxDoc()).  Also, it would slow
down scoring to have to lookup & multiply in doc's contributation, and
the field's.  I don't have a good sense of how often the added
precision is helpful though.  Karl have you tested that?  EG using
function queries you could easily emulate "per-document norms".


> Field specified norms in MatchAllDocumentsScorer 
> -------------------------------------------------
>
>                 Key: LUCENE-1543
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Query/Scoring
>    Affects Versions: 2.4
>            Reporter: Karl Wettin
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1543.txt
>
>
> This patch allows for optionally setting a field to use for norms factoring when scoring a MatchingAllDocumentsQuery.
> From the test case:
> {code:java}
> .
>     RAMDirectory dir = new RAMDirectory();
>     IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
>     iw.setMaxBufferedDocs(2);  // force multi-segment
>     addDoc("one", iw, 1f);
>     addDoc("two", iw, 20f);
>     addDoc("three four", iw, 300f);
>     iw.close();
>     IndexReader ir = IndexReader.open(dir);
>     IndexSearcher is = new IndexSearcher(ir);
>     ScoreDoc[] hits;
>     // assert with norms scoring turned off
>     hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
>     assertEquals(3, hits.length);
>     assertEquals("one", ir.document(hits[0].doc).get("key"));
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("three four", ir.document(hits[2].doc).get("key"));
>     // assert with norms scoring turned on
>     MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
>     assertEquals(3, hits.length);
> //    is.explain(normsQuery, hits[0].doc);
>     hits = is.search(normsQuery, null, 1000).scoreDocs;
>     assertEquals("three four", ir.document(hits[0].doc).get("key"));    
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("one", ir.document(hits[2].doc).get("key"));
> {code}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1543) Field specified norms in MatchAllDocumentsScorer

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12683391#action_12683391 ] 

Michael McCandless commented on LUCENE-1543:
--------------------------------------------

Karl, is there a reason why a function query can't be used in your situation?  It seems like it should work?

> Field specified norms in MatchAllDocumentsScorer 
> -------------------------------------------------
>
>                 Key: LUCENE-1543
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Query/Scoring
>    Affects Versions: 2.4
>            Reporter: Karl Wettin
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1543.txt
>
>
> This patch allows for optionally setting a field to use for norms factoring when scoring a MatchingAllDocumentsQuery.
> From the test case:
> {code:java}
> .
>     RAMDirectory dir = new RAMDirectory();
>     IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
>     iw.setMaxBufferedDocs(2);  // force multi-segment
>     addDoc("one", iw, 1f);
>     addDoc("two", iw, 20f);
>     addDoc("three four", iw, 300f);
>     iw.close();
>     IndexReader ir = IndexReader.open(dir);
>     IndexSearcher is = new IndexSearcher(ir);
>     ScoreDoc[] hits;
>     // assert with norms scoring turned off
>     hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
>     assertEquals(3, hits.length);
>     assertEquals("one", ir.document(hits[0].doc).get("key"));
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("three four", ir.document(hits[2].doc).get("key"));
>     // assert with norms scoring turned on
>     MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
>     assertEquals(3, hits.length);
> //    is.explain(normsQuery, hits[0].doc);
>     hits = is.search(normsQuery, null, 1000).scoreDocs;
>     assertEquals("three four", ir.document(hits[0].doc).get("key"));    
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("one", ir.document(hits[2].doc).get("key"));
> {code}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1543) Field specified norms in MatchAllDocumentsScorer

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675115#action_12675115 ] 

Yonik Seeley commented on LUCENE-1543:
--------------------------------------

Couldn't you just use a TermQuery?
Or a BooleanQuery with a MatchAllDocsQuery and an optional TermQuery?

> Field specified norms in MatchAllDocumentsScorer 
> -------------------------------------------------
>
>                 Key: LUCENE-1543
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Query/Scoring
>    Affects Versions: 2.4
>            Reporter: Karl Wettin
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1543.txt
>
>
> This patch allows for optionally setting a field to use for norms factoring when scoring a MatchingAllDocumentsQuery.
> From the test case:
> {code:java}
> .
>     RAMDirectory dir = new RAMDirectory();
>     IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
>     iw.setMaxBufferedDocs(2);  // force multi-segment
>     addDoc("one", iw, 1f);
>     addDoc("two", iw, 20f);
>     addDoc("three four", iw, 300f);
>     iw.close();
>     IndexReader ir = IndexReader.open(dir);
>     IndexSearcher is = new IndexSearcher(ir);
>     ScoreDoc[] hits;
>     // assert with norms scoring turned off
>     hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
>     assertEquals(3, hits.length);
>     assertEquals("one", ir.document(hits[0].doc).get("key"));
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("three four", ir.document(hits[2].doc).get("key"));
>     // assert with norms scoring turned on
>     MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
>     assertEquals(3, hits.length);
> //    is.explain(normsQuery, hits[0].doc);
>     hits = is.search(normsQuery, null, 1000).scoreDocs;
>     assertEquals("three four", ir.document(hits[0].doc).get("key"));    
>     assertEquals("two", ir.document(hits[1].doc).get("key"));
>     assertEquals("one", ir.document(hits[2].doc).get("key"));
> {code}

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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org