mirror of https://github.com/apache/lucene.git
Fix LukeRequestHandler so it doesn't rely on SolrQueryParser and report incorrect stats when field names contain special characters
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@792751 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bc59a19e85
commit
da8dd622e3
|
@ -439,6 +439,11 @@ Bug Fixes
|
|||
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)
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.apache.lucene.index.Term;
|
|||
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.FieldType;
|
|||
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 @@ public class LukeRequestHandler extends RequestHandlerBase
|
|||
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 @@ public class LukeRequestHandler extends RequestHandlerBase
|
|||
|
||||
// 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
|
||||
|
|
Loading…
Reference in New Issue