SOLR-478: Added ability to get back unique key info from LukeReqHandler

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@629343 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Grant Ingersoll 2008-02-20 04:15:10 +00:00
parent d5ef760bbc
commit ff37f3c5f0
2 changed files with 7 additions and 1 deletions

View File

@ -189,7 +189,8 @@ New Features
37. SOLR-418: Adding a query elevation component. This is an optional component to
elevate some documents to the top positions (or exclude them) for a given query.
(ryan)
38. SOLR-478: Added ability to get back unique key information from the LukeRequestHandler. (gsingers)
Changes in runtime behavior

View File

@ -341,6 +341,7 @@ public class LukeRequestHandler extends RequestHandlerBase
{
Map<String, List<String>> typeusemap = new HashMap<String, List<String>>();
SimpleOrderedMap<Object> fields = new SimpleOrderedMap<Object>();
SchemaField uniqueField = schema.getUniqueKeyField();
for( SchemaField f : schema.getFields().values() ) {
FieldType ft = f.getType();
SimpleOrderedMap<Object> field = new SimpleOrderedMap<Object>();
@ -352,6 +353,9 @@ public class LukeRequestHandler extends RequestHandlerBase
if( f.getDefaultValue() != null ) {
field.add( "default", f.getDefaultValue() );
}
if (f == uniqueField){
field.add("uniqueKey", true);
}
fields.add( f.getName(), field );
List<String> v = typeusemap.get( ft.getTypeName() );
@ -374,6 +378,7 @@ public class LukeRequestHandler extends RequestHandlerBase
SimpleOrderedMap<Object> finfo = new SimpleOrderedMap<Object>();
finfo.add("fields", fields);
finfo.add("uniqueKeyField", uniqueField.getName());
finfo.add("types", types);
return finfo;
}