zacharymorn commented on a change in pull request #1978:
URL: https://github.com/apache/lucene-solr/pull/1978#discussion_r505987825



##########
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:
       I've found a work-around in test and able to test with tighter 
condition, and assert for explanation message. Could you please let me know if 
this looks good to you?




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to