SOLR-7799: Added includeIndexFieldFlags to /admin/luke

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1693935 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2015-08-03 17:06:49 +00:00
parent 12fb9eda87
commit 2255cd3e54
2 changed files with 19 additions and 19 deletions

View File

@ -176,6 +176,9 @@ New Features
* SOLR-5882: score local parameter for block join query parser {!parent} (Andrey Kudryavtsev, Mikhail Khludnev) * SOLR-5882: score local parameter for block join query parser {!parent} (Andrey Kudryavtsev, Mikhail Khludnev)
* SOLR-7799: Added includeIndexFieldFlags (backwards compatible default is true) to /admin/luke.
When there are many fields in the index, setting this flag to false can dramatically speed up requests. (ehatcher)
Bug Fixes Bug Fixes
---------------------- ----------------------

View File

@ -98,6 +98,7 @@ public class LukeRequestHandler extends RequestHandlerBase
private static Logger log = LoggerFactory.getLogger(LukeRequestHandler.class); private static Logger log = LoggerFactory.getLogger(LukeRequestHandler.class);
public static final String NUMTERMS = "numTerms"; public static final String NUMTERMS = "numTerms";
public static final String INCLUDE_INDEX_FIELD_FLAGS = "includeIndexFieldFlags";
public static final String DOC_ID = "docId"; public static final String DOC_ID = "docId";
public static final String ID = "id"; public static final String ID = "id";
public static final int DEFAULT_COUNT = 10; public static final int DEFAULT_COUNT = 10;
@ -372,29 +373,25 @@ public class LukeRequestHandler extends RequestHandlerBase
} }
if(sfield != null && sfield.indexed() ) { if(sfield != null && sfield.indexed() ) {
// In the pre-4.0 days, this did a veeeery expensive range query. But we can be much faster now, if (params.getBool(INCLUDE_INDEX_FIELD_FLAGS,true)) {
// so just do this all the time.
StoredDocument doc = getFirstLiveDoc(terms, reader); StoredDocument doc = getFirstLiveDoc(terms, reader);
if (doc != null) {
if( doc != null ) {
// Found a document with this field // Found a document with this field
try { try {
StorableField fld = doc.getField( fieldName ); StorableField fld = doc.getField(fieldName);
if( fld != null ) { if (fld != null) {
fieldMap.add("index", getFieldFlags(fld)); fieldMap.add("index", getFieldFlags(fld));
} } else {
else {
// it is a non-stored field... // it is a non-stored field...
fieldMap.add("index", "(unstored field)"); fieldMap.add("index", "(unstored field)");
} }
} } catch (Exception ex) {
catch( Exception ex ) { log.warn("error reading field: " + fieldName);
log.warn( "error reading field: "+fieldName );
} }
} }
fieldMap.add("docs", terms.getDocCount()); fieldMap.add("docs", terms.getDocCount());
}
} }
if (fields != null && (fields.contains(fieldName) || fields.contains("*"))) { if (fields != null && (fields.contains(fieldName) || fields.contains("*"))) {
getDetailedFieldInfo(req, fieldName, fieldMap); getDetailedFieldInfo(req, fieldName, fieldMap);