lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject svn commit: r884180 - in /lucene/solr/trunk: CHANGES.txt src/java/org/apache/solr/handler/admin/LukeRequestHandler.java src/webapp/web/admin/schema.jsp
Date Wed, 25 Nov 2009 16:28:36 GMT
Author: koji
Date: Wed Nov 25 16:28:35 2009
New Revision: 884180

URL: http://svn.apache.org/viewvc?rev=884180&view=rev
Log:
SOLR-1601: Schema browser does not indicate presence of charFilter

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
    lucene/solr/trunk/src/webapp/web/admin/schema.jsp

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=884180&r1=884179&r2=884180&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Wed Nov 25 16:28:35 2009
@@ -99,6 +99,7 @@
   the behavior of a non-distributed request since it only returned
   the id,score fields instead of all fields in addition to score. (yonik)
 
+* SOLR-1601: Schema browser does not indicate presence of charFilter. (koji)
 
 Other Changes
 ----------------------

Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java?rev=884180&r1=884179&r2=884180&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java Wed Nov
25 16:28:35 2009
@@ -44,6 +44,7 @@
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.PriorityQueue;
+import org.apache.solr.analysis.CharFilterFactory;
 import org.apache.solr.analysis.TokenFilterFactory;
 import org.apache.solr.analysis.TokenizerChain;
 import org.apache.solr.analysis.TokenizerFactory;
@@ -391,25 +392,40 @@
 	  SimpleOrderedMap<Object> aninfo = new SimpleOrderedMap<Object>();
 	  aninfo.add("className", analyzer.getClass().getName());
 	  if (analyzer instanceof TokenizerChain) {
-		   SimpleOrderedMap<Object> tokenizer = new SimpleOrderedMap<Object>();
-	       TokenizerChain tchain = (TokenizerChain)analyzer;
-	       TokenizerFactory tfac = tchain.getTokenizerFactory();
-	       tokenizer.add("className", tfac.getClass().getName());
-	       tokenizer.add("args", tfac.getArgs());
-	       aninfo.add("tokenizer", tokenizer);
-	       TokenFilterFactory[] filtfacs = tchain.getTokenFilterFactories();
-	       
-        SimpleOrderedMap<Map<String, Object>> filters = new SimpleOrderedMap<Map<String,
Object>>();
-        for (TokenFilterFactory filtfac : filtfacs) {
-	    	   Map<String, Object> tok = new HashMap<String, Object>();
-           String className = filtfac.getClass().getName();
-           tok.put("className", className);
-	    	   tok.put("args", filtfac.getArgs());
-	    	   filters.add(className.substring(className.lastIndexOf('.')+1), tok);
-	       }
-	       if (filters.size() > 0) {
-	    	   aninfo.add("filters", filters);
-	       }
+
+	    TokenizerChain tchain = (TokenizerChain)analyzer;
+
+      CharFilterFactory[] cfiltfacs = tchain.getCharFilterFactories();
+      SimpleOrderedMap<Map<String, Object>> cfilters = new SimpleOrderedMap<Map<String,
Object>>();
+      for (CharFilterFactory cfiltfac : cfiltfacs) {
+        Map<String, Object> tok = new HashMap<String, Object>();
+        String className = cfiltfac.getClass().getName();
+        tok.put("className", className);
+        tok.put("args", cfiltfac.getArgs());
+        cfilters.add(className.substring(className.lastIndexOf('.')+1), tok);
+      }
+      if (cfilters.size() > 0) {
+        aninfo.add("charFilters", cfilters);
+      }
+      
+      SimpleOrderedMap<Object> tokenizer = new SimpleOrderedMap<Object>();
+      TokenizerFactory tfac = tchain.getTokenizerFactory();
+      tokenizer.add("className", tfac.getClass().getName());
+      tokenizer.add("args", tfac.getArgs());
+      aninfo.add("tokenizer", tokenizer);
+
+      TokenFilterFactory[] filtfacs = tchain.getTokenFilterFactories();
+      SimpleOrderedMap<Map<String, Object>> filters = new SimpleOrderedMap<Map<String,
Object>>();
+      for (TokenFilterFactory filtfac : filtfacs) {
+        Map<String, Object> tok = new HashMap<String, Object>();
+        String className = filtfac.getClass().getName();
+        tok.put("className", className);
+        tok.put("args", filtfac.getArgs());
+        filters.add(className.substring(className.lastIndexOf('.')+1), tok);
+      }
+      if (filters.size() > 0) {
+        aninfo.add("filters", filters);
+      }
 	  }
 	  return aninfo;
   }

Modified: lucene/solr/trunk/src/webapp/web/admin/schema.jsp
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/schema.jsp?rev=884180&r1=884179&r2=884180&view=diff
==============================================================================
--- lucene/solr/trunk/src/webapp/web/admin/schema.jsp (original)
+++ lucene/solr/trunk/src/webapp/web/admin/schema.jsp Wed Nov 25 16:28:35 2009
@@ -282,7 +282,7 @@
     //Displays information about an Analyzer in the main content area
     displayAnalyzer: function(analyzer, type, shouldCollapse) {
       var tid = type.replace(' ', '');
-      var collapse = shouldCollapse && (analyzer.tokenizer != undefined || analyzer.filters
!= undefined);
+      var collapse = shouldCollapse && (analyzer.charFilters != undefined || analyzer.tokenizer
!= undefined || analyzer.filters != undefined);
       $('#mainInfo').append(solr.createNameValueText(type, function(p) {
         p.appendChild(document.createTextNode(analyzer.className + ' '));
         if (collapse) {
@@ -298,6 +298,24 @@
       if (collapse) {
         adiv.style.display='none';
       }
+      if (analyzer.charFilters != undefined) {
+        adiv.appendChild(solr.createNameValueText('Char Filters', ''));
+        var f = document.createElement('ol');
+        $.each(analyzer.charFilters, function(i, item) {
+          var fil = document.createElement('li');
+          var filterText = item.className;
+          if (item.args != undefined) {
+            filterText += ' args:{'
+            $.each(item.args, function(fi, fitem) {
+              filterText += fi + ': ' + fitem + ' ';
+            });
+            filterText +='}';
+            fil.innerHTML = filterText;
+            f.appendChild(fil);
+          }
+        });
+        adiv.appendChild(f);
+      }
       if (analyzer.tokenizer != undefined) {
         adiv.appendChild(solr.createNameValueText("Tokenizer Class", analyzer.tokenizer.className));
       }



Mime
View raw message