From ff37f3c5f0e3752e91da12b4640f6d4db3501815 Mon Sep 17 00:00:00 2001 From: Grant Ingersoll Date: Wed, 20 Feb 2008 04:15:10 +0000 Subject: [PATCH] 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 --- CHANGES.txt | 3 ++- .../org/apache/solr/handler/admin/LukeRequestHandler.java | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 76127725617..68b1e35ae09 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java b/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java index 51052bd1e98..a73d2fa115b 100644 --- a/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java +++ b/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java @@ -341,6 +341,7 @@ public class LukeRequestHandler extends RequestHandlerBase { Map> typeusemap = new HashMap>(); SimpleOrderedMap fields = new SimpleOrderedMap(); + SchemaField uniqueField = schema.getUniqueKeyField(); for( SchemaField f : schema.getFields().values() ) { FieldType ft = f.getType(); SimpleOrderedMap field = new SimpleOrderedMap(); @@ -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 v = typeusemap.get( ft.getTypeName() ); @@ -374,6 +378,7 @@ public class LukeRequestHandler extends RequestHandlerBase SimpleOrderedMap finfo = new SimpleOrderedMap(); finfo.add("fields", fields); + finfo.add("uniqueKeyField", uniqueField.getName()); finfo.add("types", types); return finfo; }