You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/10/14 22:10:34 UTC
[GitHub] [lucene-solr] jpountz commented on a change in pull request #1978: LUCENE-9524: Fix NPE in SpanWeight#explain when no scoring is require…
jpountz commented on a change in pull request #1978:
URL: https://github.com/apache/lucene-solr/pull/1978#discussion_r505009820
##########
File path: lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndex.java
##########
@@ -618,4 +622,21 @@ public void testToStringDebug() {
"fields=2, terms=2, positions=3", mi.toStringDebug());
}
+ public void testExplain() throws ParseException, IOException {
Review comment:
I don't think this is specific to MemoryIndex, so can you move this test to TestSpansExplanations?
##########
File path: lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndex.java
##########
@@ -618,4 +622,21 @@ public void testToStringDebug() {
"fields=2, terms=2, positions=3", mi.toStringDebug());
}
+ public void testExplain() throws ParseException, IOException {
+ String queryString = "(lorem AND NOT \"dolor lorem\") OR ipsum";
+ String text = "dolor lorem ipsum";
+
+ Analyzer analyzer = new MockAnalyzer(random());
+ Query query = new ComplexPhraseQueryParser("content", analyzer).parse(queryString);
+
+ MemoryIndex memoryIndex = new MemoryIndex(true);
+ memoryIndex.addField("content", text, analyzer);
+
+ IndexSearcher searcher = memoryIndex.createSearcher();
+
+ TopDocs topDocs = searcher.search(query, 1);
+ ScoreDoc match = topDocs.scoreDocs[0];
+ searcher.explain(query, match.doc);
Review comment:
can you assert on the explanation string?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org