[ 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-unsubscr...@lucene.apache.org For additional commands, e-mail: java-dev-h...@lucene.apache.org