lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gbow...@apache.org
Subject svn commit: r1373117 - in /lucene/dev/trunk/solr: core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java webapp/web/js/scripts/schema-browser.js webapp/web/tpl/schema-browser.html
Date Tue, 14 Aug 2012 21:16:17 GMT
Author: gbowyer
Date: Tue Aug 14 21:16:17 2012
New Revision: 1373117

URL: http://svn.apache.org/viewvc?rev=1373117&view=rev
Log:
SOLR-3572: Make schema-browser show custom similarities

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
    lucene/dev/trunk/solr/webapp/web/js/scripts/schema-browser.js
    lucene/dev/trunk/solr/webapp/web/tpl/schema-browser.html

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java?rev=1373117&r1=1373116&r2=1373117&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
(original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
Tue Aug 14 21:16:17 2012
@@ -31,6 +31,7 @@ import org.apache.lucene.document.Field;
 import org.apache.lucene.index.*;
 import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.search.DocIdSetIterator;
+import org.apache.lucene.search.similarities.Similarity;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.CharsRef;
@@ -425,6 +426,7 @@ public class LukeRequestHandler extends 
       field.add("className", ft.getClass().getName());
       field.add("indexAnalyzer", getAnalyzerInfo(ft.getAnalyzer()));
       field.add("queryAnalyzer", getAnalyzerInfo(ft.getQueryAnalyzer()));
+      field.add("similarity", getSimilarityInfo(ft.getSimilarity()));
       types.add( ft.getTypeName(), field );
     }
 
@@ -450,6 +452,14 @@ public class LukeRequestHandler extends 
     return finfo;
   }
 
+  private static SimpleOrderedMap<Object> getSimilarityInfo(Similarity similarity)
{
+    SimpleOrderedMap<Object> toReturn = new SimpleOrderedMap<Object>();
+    if (similarity != null) {
+      toReturn.add("className", similarity.getClass().getName());
+      toReturn.add("details", similarity.toString());
+    }
+    return toReturn;
+  }
 
   private static SimpleOrderedMap<Object> getAnalyzerInfo(Analyzer analyzer) {
     SimpleOrderedMap<Object> aninfo = new SimpleOrderedMap<Object>();

Modified: lucene/dev/trunk/solr/webapp/web/js/scripts/schema-browser.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/schema-browser.js?rev=1373117&r1=1373116&r2=1373117&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/schema-browser.js (original)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/schema-browser.js Tue Aug 14 21:16:17 2012
@@ -871,7 +871,7 @@ sammy.get
         var pig_element = $( 'dt.position-increment-gap', options_element );
         if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].positionIncrementGap
)
         {
-          $( 'dt.position-increment-gap', options_element )
+          $( 'dd.position-increment-gap', options_element )
             .remove();
 
           pig_element
@@ -883,7 +883,18 @@ sammy.get
           $( '.position-increment-gap', options_element )
             .hide();
         }
-                
+
+        var similarity_element = $( 'dt.similarity', options_element );
+        if ( is_t && schema_browser_data.types[field] && schema_browser_data.types[field].similarity
) {
+            var similarity = schema_browser_data.types[field].similarity
+            $( 'dd.similarity', options_element ).remove();
+            similarity_element
+                .show()
+                .after(['<dd class="similarity">', similarity.details.esc(), ' (',
similarity.className.esc(), ') </dd>'].join(""));
+        } else {
+            $( '.similarity', options_element ).hide();
+        }
+
         var analyzer_element = $( '.analyzer', data_element );
         var analyzer_data = null;
 
@@ -1190,4 +1201,4 @@ sammy.get
       trigger_params
     );
   }
-);
\ No newline at end of file
+);

Modified: lucene/dev/trunk/solr/webapp/web/tpl/schema-browser.html
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/tpl/schema-browser.html?rev=1373117&r1=1373116&r2=1373117&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/tpl/schema-browser.html (original)
+++ lucene/dev/trunk/solr/webapp/web/tpl/schema-browser.html Tue Aug 14 21:16:17 2012
@@ -35,6 +35,8 @@ limitations under the License.
 
             <dt class="field-type">Field-Type:</dt>
 
+            <dt class="similarity">Similarity:</dt>
+
             <dt class="properties">Properties:</dt>
 
             <dt class="schema">Schema:</dt>



Mime
View raw message