You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2014/09/11 21:44:54 UTC

svn commit: r1624372 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/CHANGES.txt solr/core/ solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java solr/solrj/ solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java

Author: shalin
Date: Thu Sep 11 19:44:54 2014
New Revision: 1624372

URL: http://svn.apache.org/r1624372
Log:
SOLR-6501: Binary Response Writer does not return wildcard fields

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java
    lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java

Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1624372&r1=1624371&r2=1624372&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Thu Sep 11 19:44:54 2014
@@ -109,6 +109,9 @@ Bug Fixes
 * SOLR-6499: Log warning about multiple update request handlers
   (Noble Paul, Andreas Hubold, hossman)
 
+* SOLR-6501: Binary Response Writer does not return wildcard fields.
+  (Mike Hugo, Constantin Mitocaru, sarowe, shalin)
+
 Other Changes
 ---------------------
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java?rev=1624372&r1=1624371&r2=1624372&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java Thu Sep 11 19:44:54 2014
@@ -142,7 +142,7 @@ public class BinaryResponseWriter implem
       }
       
       Set<String> fnames = returnFields.getLuceneFieldNames();
-      boolean onlyPseudoFields = (fnames == null && !returnFields.wantsAllFields())
+      boolean onlyPseudoFields = (fnames == null && !returnFields.wantsAllFields() && !returnFields.hasPatternMatching())
           || (fnames != null && fnames.size() == 1 && SolrReturnFields.SCORE.equals(fnames.iterator().next()));
       context.iterator = ids.iterator();
       for (int i = 0; i < sz; i++) {

Modified: lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java?rev=1624372&r1=1624371&r2=1624372&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java (original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java Thu Sep 11 19:44:54 2014
@@ -1396,6 +1396,64 @@ abstract public class SolrExampleTests e
     }
   }
 
+  @Test
+  public void testFieldGlobbing() throws Exception  {
+    SolrServer server = getSolrServer();
+
+    SolrInputDocument doc = new SolrInputDocument();
+    doc.addField("id", "testFieldGlobbing");
+    doc.addField("x_s", "x");
+    doc.addField("y_s", "y");
+    doc.addField("z_s", "z");
+    server.add(doc);
+    server.commit();
+
+    // id and glob
+    QueryResponse response = server.query(new SolrQuery("id:testFieldGlobbing").addField("id").addField("*_s"));
+    assertEquals("Document not found", 1, response.getResults().getNumFound());
+    assertEquals("All requested fields were not returned", 4, response.getResults().get(0).getFieldNames().size());
+
+    // just globs
+    response = server.query(new SolrQuery("id:testFieldGlobbing").addField("*_s"));
+    assertEquals("Document not found", 1, response.getResults().getNumFound());
+    assertEquals("All requested fields were not returned", 3, response.getResults().get(0).getFieldNames().size());
+
+    // just id
+    response = server.query(new SolrQuery("id:testFieldGlobbing").addField("id"));
+    assertEquals("Document not found", 1, response.getResults().getNumFound());
+    assertEquals("All requested fields were not returned", 1, response.getResults().get(0).getFieldNames().size());
+
+    // id and pseudo field and glob
+    response = server.query(new SolrQuery("id:testFieldGlobbing").addField("id").addField("[docid]").addField("*_s"));
+    assertEquals("Document not found", 1, response.getResults().getNumFound());
+    assertEquals("All requested fields were not returned", 5, response.getResults().get(0).getFieldNames().size());
+
+    // pseudo field and glob
+    response = server.query(new SolrQuery("id:testFieldGlobbing").addField("[docid]").addField("*_s"));
+    assertEquals("Document not found", 1, response.getResults().getNumFound());
+    assertEquals("All requested fields were not returned", 4, response.getResults().get(0).getFieldNames().size());
+
+    // just a pseudo field
+    response = server.query(new SolrQuery("id:testFieldGlobbing").addField("[docid]"));
+    assertEquals("Document not found", 1, response.getResults().getNumFound());
+    assertEquals("All requested fields were not returned", 1, response.getResults().get(0).getFieldNames().size());
+
+    // only score
+    response = server.query(new SolrQuery("id:testFieldGlobbing").addField("score"));
+    assertEquals("Document not found", 1, response.getResults().getNumFound());
+    assertEquals("All requested fields were not returned", 1, response.getResults().get(0).getFieldNames().size());
+
+    // pseudo field and score
+    response = server.query(new SolrQuery("id:testFieldGlobbing").addField("score").addField("[docid]"));
+    assertEquals("Document not found", 1, response.getResults().getNumFound());
+    assertEquals("All requested fields were not returned", 2, response.getResults().get(0).getFieldNames().size());
+
+    // score and globs
+    response = server.query(new SolrQuery("id:testFieldGlobbing").addField("score").addField("*_s"));
+    assertEquals("Document not found", 1, response.getResults().getNumFound());
+    assertEquals("All requested fields were not returned", 4, response.getResults().get(0).getFieldNames().size());
+  }
+
   /** 
    * Depth first search of a SolrInputDocument looking for a decendent by id, 
    * returns null if it's not a decendent