SOLR-305: analysis.jsp can be given a fieldtype instead of a field name

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@557870 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2007-07-20 05:28:42 +00:00
parent dd31a89b2f
commit 773ec01848
2 changed files with 24 additions and 5 deletions

View File

@ -107,6 +107,9 @@ New Features
18. SOLR-307: Added NGramFilterFactory and EdgeNGramFilterFactory.
(Thomas Peuss via Otis Gospodnetic)
19. SOLR-305: analysis.jsp can be given a fieldtype instead of a field
name. (hossman)
Changes in runtime behavior
Optimizations

View File

@ -37,6 +37,10 @@
<%@include file="header.jsp" %>
<%
// is name a field name or a type name?
String nt = request.getParameter("nt");
if (nt==null || nt.length()==0) nt="name"; // assume field name
nt = nt.toLowerCase().trim();
String name = request.getParameter("name");
if (name==null || name.length()==0) name="";
String val = request.getParameter("val");
@ -59,7 +63,10 @@
<table>
<tr>
<td>
<strong>Field name</strong>
<strong>Field
<select name="nt">
<option <%= nt.equals("name") ? "selected=\"selected\"" : "" %> >name</option>
<option <%= nt.equals("type") ? "selected=\"selected\"" : "" %>>type</option></strong>
</td>
<td>
<input class="std" name="name" type="text" value="<% XML.escapeCharData(name, out); %>">
@ -111,10 +118,19 @@
SchemaField field=null;
if (name!="") {
try {
field = schema.getField(name);
} catch (Exception e) {
out.println("<strong>Unknown Field " + name + "</strong>");
if (nt.equals("name")) {
try {
field = schema.getField(name);
} catch (Exception e) {
out.println("<strong>Unknown Field: " + name + "</strong>");
}
} else {
FieldType t = schema.getFieldTypes().get(name);
if (null == t) {
out.println("<strong>Unknown Field Type: " + name + "</strong>");
} else {
field = new SchemaField("fakefieldoftype:"+name, t);
}
}
}