You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by ho...@apache.org on 2009/07/10 01:50:20 UTC

svn commit: r792751 - in /lucene/solr/trunk: CHANGES.txt src/java/org/apache/solr/handler/admin/LukeRequestHandler.java

Author: hossman
Date: Thu Jul  9 23:50:20 2009
New Revision: 792751

URL: http://svn.apache.org/viewvc?rev=792751&view=rev
Log:
Fix LukeRequestHandler so it doesn't rely on SolrQueryParser and report incorrect stats when field names contain special characters

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=792751&r1=792750&r2=792751&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Thu Jul  9 23:50:20 2009
@@ -439,6 +439,11 @@
     never manifested in normal Solr use and only potentially affect
     custom code. (yonik)
 
+53. SOLR-1171: Fix LukeRequestHandler so it doesn't rely on SolrQueryParser
+    and report incorrect stats when field names contain characters
+    SolrQueryParser considers special.
+    (hossman)
+
 Other Changes
 ----------------------
  1. Upgraded to Lucene 2.4.0 (yonik)

Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java?rev=792751&r1=792750&r2=792751&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java Thu Jul  9 23:50:20 2009
@@ -40,6 +40,7 @@
 import org.apache.lucene.index.TermEnum;
 import org.apache.lucene.index.TermFreqVector;
 import org.apache.lucene.search.Query;
+import org.apache.lucene.search.ConstantScoreRangeQuery;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.PriorityQueue;
@@ -59,7 +60,6 @@
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.SchemaField;
 import org.apache.solr.search.SolrIndexSearcher;
-import org.apache.solr.search.SolrQueryParser;
 
 /**
  * This handler exposes the internal lucene index.  It is inspired by and 
@@ -273,7 +273,6 @@
   private static SimpleOrderedMap<Object> getIndexedFieldsInfo( 
     final SolrIndexSearcher searcher, final Set<String> fields, final int numTerms ) 
     throws Exception {
-    SolrQueryParser qp = searcher.getSchema().getSolrQueryParser(null);
 
     IndexReader reader = searcher.getReader();
     IndexSchema schema = searcher.getSchema();
@@ -303,7 +302,7 @@
 
       // If numTerms==0, the call is just asking for a quick field list
       if( ttinfo != null && sfield != null && sfield.indexed() ) {
-        Query q = qp.parse( fieldName+":[* TO *]" ); 
+        Query q = new ConstantScoreRangeQuery(fieldName,null,null,false,false); 
         TopDocs top = searcher.search( q, 1 );
         if( top.totalHits > 0 ) {
           // Find a document with this field