mirror of https://github.com/apache/lucene.git
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:
parent
d5ef760bbc
commit
ff37f3c5f0
|
@ -189,7 +189,8 @@ New Features
|
||||||
37. SOLR-418: Adding a query elevation component. This is an optional component to
|
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.
|
elevate some documents to the top positions (or exclude them) for a given query.
|
||||||
(ryan)
|
(ryan)
|
||||||
|
|
||||||
|
38. SOLR-478: Added ability to get back unique key information from the LukeRequestHandler. (gsingers)
|
||||||
|
|
||||||
Changes in runtime behavior
|
Changes in runtime behavior
|
||||||
|
|
||||||
|
|
|
@ -341,6 +341,7 @@ public class LukeRequestHandler extends RequestHandlerBase
|
||||||
{
|
{
|
||||||
Map<String, List<String>> typeusemap = new HashMap<String, List<String>>();
|
Map<String, List<String>> typeusemap = new HashMap<String, List<String>>();
|
||||||
SimpleOrderedMap<Object> fields = new SimpleOrderedMap<Object>();
|
SimpleOrderedMap<Object> fields = new SimpleOrderedMap<Object>();
|
||||||
|
SchemaField uniqueField = schema.getUniqueKeyField();
|
||||||
for( SchemaField f : schema.getFields().values() ) {
|
for( SchemaField f : schema.getFields().values() ) {
|
||||||
FieldType ft = f.getType();
|
FieldType ft = f.getType();
|
||||||
SimpleOrderedMap<Object> field = new SimpleOrderedMap<Object>();
|
SimpleOrderedMap<Object> field = new SimpleOrderedMap<Object>();
|
||||||
|
@ -352,6 +353,9 @@ public class LukeRequestHandler extends RequestHandlerBase
|
||||||
if( f.getDefaultValue() != null ) {
|
if( f.getDefaultValue() != null ) {
|
||||||
field.add( "default", f.getDefaultValue() );
|
field.add( "default", f.getDefaultValue() );
|
||||||
}
|
}
|
||||||
|
if (f == uniqueField){
|
||||||
|
field.add("uniqueKey", true);
|
||||||
|
}
|
||||||
fields.add( f.getName(), field );
|
fields.add( f.getName(), field );
|
||||||
|
|
||||||
List<String> v = typeusemap.get( ft.getTypeName() );
|
List<String> v = typeusemap.get( ft.getTypeName() );
|
||||||
|
@ -374,6 +378,7 @@ public class LukeRequestHandler extends RequestHandlerBase
|
||||||
|
|
||||||
SimpleOrderedMap<Object> finfo = new SimpleOrderedMap<Object>();
|
SimpleOrderedMap<Object> finfo = new SimpleOrderedMap<Object>();
|
||||||
finfo.add("fields", fields);
|
finfo.add("fields", fields);
|
||||||
|
finfo.add("uniqueKeyField", uniqueField.getName());
|
||||||
finfo.add("types", types);
|
finfo.add("types", types);
|
||||||
return finfo;
|
return finfo;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue