lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sim...@apache.org
Subject svn commit: r1055622 [10/14] - in /lucene/dev/branches/docvalues: ./ dev-tools/ dev-tools/eclipse/ dev-tools/idea/ dev-tools/idea/.idea/ dev-tools/idea/.idea/libraries/ dev-tools/idea/lucene/ dev-tools/idea/lucene/contrib/ dev-tools/idea/lucene/contrib...
Date Wed, 05 Jan 2011 20:25:44 GMT
Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/response/XMLWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/response/XMLWriter.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/response/XMLWriter.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/response/XMLWriter.java Wed Jan  5 20:25:17 2011
@@ -27,7 +27,6 @@ import org.apache.solr.search.SolrIndexS
 import org.apache.solr.search.DocList;
 import org.apache.solr.search.DocIterator;
 import org.apache.solr.search.DocSet;
-import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.SchemaField;
 import org.apache.solr.schema.TextField;
 
@@ -37,34 +36,54 @@ import java.util.*;
 
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.document.Document;
-/**
- * @version $Id$
- */
-final public class XMLWriter {
+
+
+public final class XMLWriter extends TextResponseWriter {
 
   public static float CURRENT_VERSION=2.2f;
 
-  //
-  // static thread safe part
-  //
   private static final char[] XML_START1="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".toCharArray();
 
   private static final char[] XML_STYLESHEET="<?xml-stylesheet type=\"text/xsl\" href=\"/admin/".toCharArray();
   private static final char[] XML_STYLESHEET_END=".xsl\"?>\n".toCharArray();
 
+  /***
   private static final char[] XML_START2_SCHEMA=(
   "<response xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
   +" xsi:noNamespaceSchemaLocation=\"http://pi.cnet.com/cnet-search/response.xsd\">\n"
           ).toCharArray();
-  private static final char[] XML_START2_NOSCHEMA=(
-  "<response>\n"
-          ).toCharArray();
+  ***/
+  
+  private static final char[] XML_START2_NOSCHEMA=("<response>\n").toCharArray();
 
+  private boolean defaultIndent=false;
+  final int version;
+
+  // temporary working objects...
+  // be careful not to use these recursively...
+  private final ArrayList tlst = new ArrayList();
 
   public static void writeResponse(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) throws IOException {
+    XMLWriter xmlWriter = null;
+    try {
+      xmlWriter = new XMLWriter(writer, req, rsp);
+      xmlWriter.writeResponse();
+    } finally {
+      xmlWriter.close();
+    }
+  }
+
+  public XMLWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) {
+    super(writer, req, rsp);
+
+    String version = req.getParams().get("version");
+    float ver = version==null? CURRENT_VERSION : Float.parseFloat(version);
+    this.version = (int)(ver*1000);
+  }
+
 
-    String ver = req.getParams().get(CommonParams.VERSION);
 
+  public void writeResponse() throws IOException {
     writer.write(XML_START1);
 
     String stylesheet = req.getParams().get("stylesheet");
@@ -74,29 +93,15 @@ final public class XMLWriter {
       writer.write(XML_STYLESHEET_END);
     }
 
+    /***
     String noSchema = req.getParams().get("noSchema");
     // todo - change when schema becomes available?
     if (false && noSchema == null)
       writer.write(XML_START2_SCHEMA);
     else
       writer.write(XML_START2_NOSCHEMA);
-
-    // create an instance for each request to handle
-    // non-thread safe stuff (indentation levels, etc)
-    // and to encapsulate writer, schema, and searcher so
-    // they don't have to be passed around in every function.
-    //
-    XMLWriter xw = new XMLWriter(writer, req.getSchema(), req, ver);
-    xw.defaultFieldList = rsp.getReturnFields();
-
-    String indent = req.getParams().get("indent");
-    if (indent != null) {
-      if ("".equals(indent) || "off".equals(indent)) {
-        xw.setIndent(false);
-      } else {
-        xw.setIndent(true);
-      }
-    }
+     ***/
+    writer.write(XML_START2_NOSCHEMA);
 
     // dump response values
     NamedList lst = rsp.getValues();
@@ -105,90 +110,41 @@ final public class XMLWriter {
     int sz = lst.size();
     int start=0;
 
-    // special case the response header if the version is 2.1 or less    
-    if (xw.version<=2100 && sz>0) {
+    // special case the response header if the version is 2.1 or less
+    if (version<=2100 && sz>0) {
       Object header = lst.getVal(0);
       if (header instanceof NamedList && "responseHeader".equals(lst.getName(0))) {
         writer.write("<responseHeader>");
-        xw.incLevel();
+        incLevel();
         NamedList nl = (NamedList)header;
         for (int i=0; i<nl.size(); i++) {
           String name = nl.getName(i);
           Object val = nl.getVal(i);
           if ("status".equals(name) || "QTime".equals(name)) {
-            xw.writePrim(name,null,val.toString(),false);
+            writePrim(name,null,val.toString(),false);
           } else {
-            xw.writeVal(name,val);
+            writeVal(name,val);
           }
         }
-        xw.decLevel();
+        decLevel();
         writer.write("</responseHeader>");
         start=1;
       }
     }
 
     for (int i=start; i<sz; i++) {
-      xw.writeVal(lst.getName(i),lst.getVal(i));
+      writeVal(lst.getName(i),lst.getVal(i));
     }
 
     writer.write("\n</response>\n");
   }
 
 
-  ////////////////////////////////////////////////////////////
-  // request instance specific (non-static, not shared between threads)
-  ////////////////////////////////////////////////////////////
-
-  private final Writer writer;
-  private final IndexSchema schema; // needed to write fields of docs
-  private final SolrQueryRequest request; // the request
-
-  private int level;
-  private boolean defaultIndent=false;
-  private boolean doIndent=false;
-
-  // fieldList... the set of fields to return for each document
-  private Set<String> defaultFieldList;
-
-
-  // if a list smaller than this threshold is encountered, elements
-  // will be written on the same line.
-  // maybe constructed types should always indent first?
-  private final int indentThreshold=0;
 
-  final int version;
 
 
-  // temporary working objects...
-  // be careful not to use these recursively...
-  private final ArrayList tlst = new ArrayList();
-  private final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.US);
-  private final StringBuilder sb = new StringBuilder();
-
-  public XMLWriter(Writer writer, IndexSchema schema, SolrQueryRequest req, String version) {
-    this.writer = writer;
-    this.schema = schema;
-    this.request = req;
-    
-    float ver = version==null? CURRENT_VERSION : Float.parseFloat(version);
-    this.version = (int)(ver*1000);
-  }
-
-  //
-  // Functions to manipulate the current logical nesting level.
-  // Any indentation will be partially based on level.
-  //
-  public void setLevel(int level) { this.level = level; }
-  public int level() { return level; }
-  public int incLevel() { return ++level; }
-  public int decLevel() { return --level; }
-  public void setIndent(boolean doIndent) {
-    this.doIndent = doIndent;
-    defaultIndent = doIndent;
-  }
-
   /** Writes the XML attribute name/val. A null val means that the attribute is missing. */
-  public void writeAttr(String name, String val) throws IOException {
+  private void writeAttr(String name, String val) throws IOException {
     writeAttr(name, val, true);
   }
 
@@ -206,63 +162,7 @@ final public class XMLWriter {
     }
   }
 
-  /**Writes a tag with attributes
-   *
-   * @param tag
-   * @param attributes
-   * @param closeTag
-   * @param escape
-   * @throws IOException
-   */
-  public void startTag(String tag, Map<String,String> attributes, boolean closeTag, boolean escape) throws IOException {
-    if (doIndent) indent();
-    writer.write('<');
-    writer.write(tag);
-    if(!attributes.isEmpty()) {
-      for (Map.Entry<String, String> entry : attributes.entrySet()) {
-        writeAttr(entry.getKey(), entry.getValue(), escape);
-      }
-    }
-    if (closeTag) {
-      writer.write("/>");
-    } else {
-      writer.write('>');
-    }
-  }
-
-  /**Write a complete tag w/ attributes and cdata (the cdata is not enclosed in $lt;!CDATA[]!&gt;
-   * @param tag
-   * @param attributes
-   * @param cdata
-   * @param escapeCdata
-   * @param escapeAttr
-   * @throws IOException
-   */
-  public void writeCdataTag(String tag, Map<String,String> attributes, String cdata, boolean escapeCdata, boolean escapeAttr) throws IOException {
-    if (doIndent) indent();
-    writer.write('<');
-    writer.write(tag);
-    if (!attributes.isEmpty()) {
-      for (Map.Entry<String, String> entry : attributes.entrySet()) {
-        writeAttr(entry.getKey(), entry.getValue(), escapeAttr);
-      }
-    }
-    writer.write('>');
-    if (cdata != null && cdata.length() > 0) {
-      if (escapeCdata) {
-        XML.escapeCharData(cdata, writer);
-      } else {
-        writer.write(cdata, 0, cdata.length());
-      }
-    }
-    writer.write("</");
-    writer.write(tag);
-    writer.write('>');
-  }
-
-
-
-  public void startTag(String tag, String name, boolean closeTag) throws IOException {
+  void startTag(String tag, String name, boolean closeTag) throws IOException {
     if (doIndent) indent();
 
     writer.write('<');
@@ -283,22 +183,6 @@ final public class XMLWriter {
     }
   }
 
-
-  // indent up to 40 spaces
-  static final char[] indentChars = new char[81];
-  static {
-    Arrays.fill(indentChars,' ');
-    indentChars[0] = '\n';  // start with a newline
-  }
-
-  public void indent() throws IOException {
-     indent(level);
-  }
-
-  public void indent(int lev) throws IOException {
-    writer.write(indentChars, 0, Math.min((lev<<1)+1, indentChars.length));
-  }
-
   private static final Comparator fieldnameComparator = new Comparator() {
     public int compare(Object o, Object o1) {
       Fieldable f1 = (Fieldable)o; Fieldable f2 = (Fieldable)o1;
@@ -309,6 +193,7 @@ final public class XMLWriter {
     }
   };
 
+  @Override
   public final void writeDoc(String name, Document doc, Set<String> returnFields, float score, boolean includeScore) throws IOException {
     startTag("doc", name, false);
     incLevel();
@@ -400,17 +285,11 @@ final public class XMLWriter {
     writer.write("</doc>");
   }
 
-  /**
-   * @since solr 1.3
-   */
-  final void writeDoc(String name, SolrDocument doc, Set<String> returnFields, boolean includeScore) throws IOException {
+  @Override
+  public void writeSolrDocument(String name, SolrDocument doc, Set<String> returnFields, Map pseudoFields) throws IOException {
     startTag("doc", name, false);
     incLevel();
 
-    if (includeScore && returnFields != null ) {
-      returnFields.add( "score" );
-    }
-
     for (String fname : doc.getFieldNames()) {
       if (returnFields!=null && !returnFields.contains(fname)) {
         continue;
@@ -427,13 +306,19 @@ final public class XMLWriter {
           doIndent=false;
           writeVal(fname, val);
           writer.write("</arr>");
-          doIndent=defaultIndent;          
+          doIndent=defaultIndent;
         } else {
-          writeVal(fname, val);          
+          writeVal(fname, val);
         }
       }
     }
 
+    if (pseudoFields != null) {
+      for (Object fname : pseudoFields.keySet()) {
+        writeVal(fname.toString(), pseudoFields.get(fname));
+      }
+    }
+
     decLevel();
     if (doIndent) indent();
     writer.write("</doc>");
@@ -449,9 +334,9 @@ final public class XMLWriter {
   }
 
   private final void writeDocuments(
-      String name, 
-      DocumentListInfo docs, 
-      Set<String> fields) throws IOException 
+      String name,
+      DocumentListInfo docs,
+      Set<String> fields) throws IOException
   {
     boolean includeScore=false;
     if (fields!=null) {
@@ -460,14 +345,14 @@ final public class XMLWriter {
         fields=null;  // null means return all stored fields
       }
     }
-    
+
     int sz=docs.getCount();
     if (doIndent) indent();
-    
+
     writer.write("<result");
     writeAttr("name",name);
-    writeAttr("numFound",Long.toString(docs.getNumFound()));  // TODO: change to long
-    writeAttr("start",Long.toString(docs.getStart()));        // TODO: change to long
+    writeAttr("numFound",Long.toString(docs.getNumFound()));
+    writeAttr("start",Long.toString(docs.getStart()));
     if (includeScore && docs.getMaxScore()!=null) {
       writeAttr("maxScore",Float.toString(docs.getMaxScore()));
     }
@@ -485,15 +370,16 @@ final public class XMLWriter {
     if (doIndent) indent();
     writer.write("</result>");
   }
-  
-  public final void writeSolrDocumentList(String name, final SolrDocumentList docs, Set<String> fields) throws IOException 
+
+  @Override
+  public final void writeSolrDocumentList(String name, final SolrDocumentList docs, Set<String> fields, Map otherFields) throws IOException
   {
-    this.writeDocuments( name, new DocumentListInfo() 
-    {  
+    this.writeDocuments( name, new DocumentListInfo()
+    {
       public int getCount() {
         return docs.size();
       }
-      
+
       public Float getMaxScore() {
         return docs.getMaxScore();
       }
@@ -508,20 +394,21 @@ final public class XMLWriter {
 
       public void writeDocs(boolean includeScore, Set<String> fields) throws IOException {
         for( SolrDocument doc : docs ) {
-          writeDoc(null, doc, fields, includeScore);
+          writeSolrDocument(null, doc, fields, null);
         }
       }
     }, fields );
   }
 
-  public final void writeDocList(String name, final DocList ids, Set<String> fields) throws IOException 
+  @Override
+  public void writeDocList(String name, final DocList ids, Set<String> fields, Map otherFields) throws IOException
   {
-    this.writeDocuments( name, new DocumentListInfo() 
-    {  
+    this.writeDocuments( name, new DocumentListInfo()
+    {
       public int getCount() {
         return ids.size();
       }
-      
+
       public Float getMaxScore() {
         return ids.maxScore();
       }
@@ -535,7 +422,7 @@ final public class XMLWriter {
       }
 
       public void writeDocs(boolean includeScore, Set<String> fields) throws IOException {
-        SolrIndexSearcher searcher = request.getSearcher();
+        SolrIndexSearcher searcher = req.getSearcher();
         DocIterator iterator = ids.iterator();
         int sz = ids.size();
         includeScore = includeScore && ids.hasScores();
@@ -558,7 +445,7 @@ final public class XMLWriter {
     if (val==null) {
       writeNull(name);
     } else if (val instanceof String) {
-      writeStr(name, (String)val);
+      writeStr(name, (String)val, true);
     } else if (val instanceof Integer) {
       // it would be slower to pass the int ((Integer)val).intValue()
       writeInt(name, val.toString());
@@ -576,19 +463,19 @@ final public class XMLWriter {
     } else if (val instanceof Double) {
       writeDouble(name, ((Double)val).doubleValue());
     } else if (val instanceof Document) {
-      writeDoc(name, (Document)val, defaultFieldList, 0.0f, false);
+      writeDoc(name, (Document)val, returnFields, 0.0f, false);
     } else if (val instanceof DocList) {
       // requires access to IndexReader
-      writeDocList(name, (DocList)val, defaultFieldList);
+      writeDocList(name, (DocList)val, returnFields, null);
     }else if (val instanceof SolrDocumentList) {
         // requires access to IndexReader
-      writeSolrDocumentList(name, (SolrDocumentList)val, defaultFieldList);  
+      writeSolrDocumentList(name, (SolrDocumentList)val, returnFields, null);
     }else if (val instanceof DocSet) {
       // how do we know what fields to read?
       // todo: have a DocList/DocSet wrapper that
       // restricts the fields to write...?
     } else if (val instanceof Map) {
-      writeMap(name, (Map)val);
+      writeMap(name, (Map)val, false, true);
     } else if (val instanceof NamedList) {
       writeNamedList(name, (NamedList)val);
     } else if (val instanceof Iterable) {
@@ -599,7 +486,7 @@ final public class XMLWriter {
       writeArray(name,(Iterator)val);
     } else {
       // default...
-      writeStr(name, val.getClass().getName() + ':' + val.toString());
+      writeStr(name, val.getClass().getName() + ':' + val.toString(), true);
     }
   }
 
@@ -611,10 +498,6 @@ final public class XMLWriter {
     int sz = val.size();
     startTag("lst", name, sz<=0);
 
-    if (sz<indentThreshold) {
-      doIndent=false;
-    }
-
     incLevel();
     for (int i=0; i<sz; i++) {
       writeVal(val.getName(i),val.getVal(i));
@@ -627,37 +510,37 @@ final public class XMLWriter {
     }
   }
 
-  
-  /**
-   * writes a Map in the same format as a NamedList, using the
-   * stringification of the key Object when it's non-null.
-   *
-   * @param name
-   * @param map
-   * @throws IOException
-   * @see SolrQueryResponse Note on Returnable Data
-   */
-  public void writeMap(String name, Map<Object,Object> map) throws IOException {
+  @Override
+  public void writeMap(String name, Map map, boolean excludeOuter, boolean isFirstVal) throws IOException {
     int sz = map.size();
-    startTag("lst", name, sz<=0);
-    incLevel();
-    for (Map.Entry<Object,Object> entry : map.entrySet()) {
+
+    if (!excludeOuter) {
+      startTag("lst", name, sz<=0);
+      incLevel();
+    }
+
+    for (Map.Entry entry : (Set<Map.Entry>)map.entrySet()) {
       Object k = entry.getKey();
       Object v = entry.getValue();
       // if (sz<indentThreshold) indent();
       writeVal( null == k ? null : k.toString(), v);
     }
-    decLevel();
-    if (sz > 0) {
-      if (doIndent) indent();
-      writer.write("</lst>");
+
+    if (!excludeOuter) {
+      decLevel();
+      if (sz > 0) {
+        if (doIndent) indent();
+        writer.write("</lst>");
+      }
     }
   }
 
+  @Override
   public void writeArray(String name, Object[] val) throws IOException {
     writeArray(name, Arrays.asList(val).iterator());
   }
 
+  @Override
   public void writeArray(String name, Iterator iter) throws IOException {
     if( iter.hasNext() ) {
       startTag("arr", name, false );
@@ -678,127 +561,53 @@ final public class XMLWriter {
   // Primitive types
   //
 
+  @Override
   public void writeNull(String name) throws IOException {
     writePrim("null",name,"",false);
   }
 
-  public void writeStr(String name, String val) throws IOException {
-    writePrim("str",name,val,true);
+  @Override
+  public void writeStr(String name, String val, boolean escape) throws IOException {
+    writePrim("str",name,val,escape);
   }
 
+  @Override
   public void writeInt(String name, String val) throws IOException {
     writePrim("int",name,val,false);
   }
 
-  public void writeInt(String name, int val) throws IOException {
-    writeInt(name,Integer.toString(val));
-  }
-
+  @Override
   public void writeLong(String name, String val) throws IOException {
     writePrim("long",name,val,false);
   }
 
-  public void writeLong(String name, long val) throws IOException {
-    writeLong(name,Long.toString(val));
-  }
-
+  @Override
   public void writeBool(String name, String val) throws IOException {
     writePrim("bool",name,val,false);
   }
 
-  public void writeBool(String name, boolean val) throws IOException {
-    writeBool(name,Boolean.toString(val));
-  }
-
-  public void writeShort(String name, String val) throws IOException {
-    writePrim("short",name,val,false);
-  }
-
-  public void writeShort(String name, short val) throws IOException {
-    writeInt(name,Short.toString(val));
-  }
-
-
-  public void writeByte(String name, String val) throws IOException {
-    writePrim("byte",name,val,false);
-  }
-
-  public void writeByte(String name, byte val) throws IOException {
-    writeInt(name,Byte.toString(val));
-  }
-
-
+  @Override
   public void writeFloat(String name, String val) throws IOException {
     writePrim("float",name,val,false);
   }
 
+  @Override
   public void writeFloat(String name, float val) throws IOException {
     writeFloat(name,Float.toString(val));
   }
 
+  @Override
   public void writeDouble(String name, String val) throws IOException {
     writePrim("double",name,val,false);
   }
 
+  @Override
   public void writeDouble(String name, double val) throws IOException {
     writeDouble(name,Double.toString(val));
   }
 
-  public void writeDate(String name, Date val) throws IOException {
-    // using a stringBuilder for numbers can be nice since
-    // a temporary string isn't used (it's added directly to the
-    // builder's buffer.
-
-    cal.setTime(val);
-
-    sb.setLength(0);
-    int i = cal.get(Calendar.YEAR);
-    sb.append(i);
-    sb.append('-');
-    i = cal.get(Calendar.MONTH) + 1;  // 0 based, so add 1
-    if (i<10) sb.append('0');
-    sb.append(i);
-    sb.append('-');
-    i=cal.get(Calendar.DAY_OF_MONTH);
-    if (i<10) sb.append('0');
-    sb.append(i);
-    sb.append('T');
-    i=cal.get(Calendar.HOUR_OF_DAY); // 24 hour time format
-    if (i<10) sb.append('0');
-    sb.append(i);
-    sb.append(':');
-    i=cal.get(Calendar.MINUTE);
-    if (i<10) sb.append('0');
-    sb.append(i);
-    sb.append(':');
-    i=cal.get(Calendar.SECOND);
-    if (i<10) sb.append('0');
-    sb.append(i);
-    i=cal.get(Calendar.MILLISECOND);
-    if (i != 0) {
-      sb.append('.');
-      if (i<100) sb.append('0');
-      if (i<10) sb.append('0');
-      sb.append(i);
-
-      // handle canonical format specifying fractional
-      // seconds shall not end in '0'.  Given the slowness of
-      // integer div/mod, simply checking the last character
-      // is probably the fastest way to check.
-      int lastIdx = sb.length()-1;
-      if (sb.charAt(lastIdx)=='0') {
-        lastIdx--;
-        if (sb.charAt(lastIdx)=='0') {
-          lastIdx--;
-        }
-        sb.setLength(lastIdx+1);
-      }
-
-    }
-    sb.append('Z');
-    writeDate(name, sb.toString());
-  }
 
+  @Override
   public void writeDate(String name, String val) throws IOException {
     writePrim("date",name,val,false);
   }
@@ -808,24 +617,8 @@ final public class XMLWriter {
   // OPT - specific writeInt, writeFloat, methods might be faster since
   // there would be less write calls (write("<int name=\"" + name + ... + </int>)
   //
-  public void writePrim(String tag, String name, String val, boolean escape) throws IOException {
-    // OPT - we could use a temp char[] (or a StringBuilder) and if the
-    // size was small enough to fit (if escape==false we can calc exact size)
-    // then we could put things directly in the temp buf.
-    // need to see what percent of CPU this takes up first though...
-    // Could test a reusable StringBuilder...
-
-    // is this needed here???
-    // Only if a fieldtype calls writeStr or something
-    // with a null val instead of calling writeNull
-    /***
-    if (val==null) {
-      if (name==null) writer.write("<null/>");
-      else writer.write("<null name=\"" + name + "/>");
-    }
-    ***/
-
-    int contentLen=val.length();
+  private void writePrim(String tag, String name, String val, boolean escape) throws IOException {
+    int contentLen = val==null ? 0 : val.length();
 
     startTag(tag, name, contentLen==0);
     if (contentLen==0) return;
@@ -836,10 +629,10 @@ final public class XMLWriter {
       writer.write(val,0,contentLen);
     }
 
-    writer.write("</");
+    writer.write('<');
+    writer.write('/');
     writer.write(tag);
     writer.write('>');
   }
 
-
 }

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BCDIntField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BCDIntField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BCDIntField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BCDIntField.java Wed Jan  5 20:25:17 2011
@@ -18,11 +18,11 @@
 package org.apache.solr.schema;
 
 import org.apache.lucene.search.SortField;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.lucene.document.Fieldable;
 import org.apache.solr.util.BCDUtils;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 
 import java.util.Map;
 import java.io.IOException;
@@ -37,7 +37,8 @@ public class BCDIntField extends FieldTy
     return getStringSort(field,reverse);
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     throw new UnsupportedOperationException("ValueSource not implemented");
   }
 
@@ -60,10 +61,6 @@ public class BCDIntField extends FieldTy
     return BCDUtils.base10kSortableIntToBase10(indexedForm);
   }
 
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeInt(name,toExternal(f));
-  }
-
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     writer.writeInt(name,toExternal(f));
   }

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BCDLongField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BCDLongField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BCDLongField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BCDLongField.java Wed Jan  5 20:25:17 2011
@@ -17,18 +17,11 @@
 
 package org.apache.solr.schema;
 
-import org.apache.solr.response.XMLWriter;
 import org.apache.lucene.document.Fieldable;
-
-import java.io.IOException;
 /**
  * @version $Id$
  */
 public class BCDLongField extends BCDIntField {
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeLong(name,toExternal(f));
-  }
-
   @Override
   public Long toObject(Fieldable f) {
     return Long.valueOf( toExternal(f) );

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BCDStrField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BCDStrField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BCDStrField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BCDStrField.java Wed Jan  5 20:25:17 2011
@@ -17,18 +17,11 @@
 
 package org.apache.solr.schema;
 
-import org.apache.solr.response.XMLWriter;
 import org.apache.lucene.document.Fieldable;
-
-import java.io.IOException;
 /**
  * @version $Id$
  */
 public class BCDStrField extends BCDIntField {
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeStr(name,toExternal(f));
-  }
-
   /**
    * This only works for strings that represent an interger.  If the string
    * is not an integer, it will not survive the base10k conversion!

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BinaryField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BinaryField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BinaryField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BinaryField.java Wed Jan  5 20:25:17 2011
@@ -18,7 +18,6 @@
 package org.apache.solr.schema;
 
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 import org.apache.solr.common.util.Base64;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.document.Field;
@@ -30,10 +29,6 @@ import java.nio.ByteBuffer;
 
 public class BinaryField extends FieldType  {
 
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeStr( name, toBase64String(toObject(f)) );
-  }
-
   private String  toBase64String(ByteBuffer buf) {
     return Base64.byteArrayToBase64(buf.array(), buf.position(), buf.limit()-buf.position());
   }
@@ -55,7 +50,7 @@ public class BinaryField extends FieldTy
     return  ByteBuffer.wrap(f.getBinaryValue(), f.getBinaryOffset(), f.getBinaryLength() ) ;
   }
 
-  public Field createField(SchemaField field, Object val, float boost) {
+  public Fieldable createField(SchemaField field, Object val, float boost) {
     if (val == null) return null;
     if (!field.stored()) {
       log.trace("Ignoring unstored binary field: " + field);

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BoolField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BoolField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BoolField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/BoolField.java Wed Jan  5 20:25:17 2011
@@ -20,6 +20,7 @@ package org.apache.solr.schema;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.OrdFieldSource;
 import org.apache.lucene.analysis.Analyzer;
@@ -27,7 +28,6 @@ import org.apache.lucene.analysis.Tokeni
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.lucene.document.Fieldable;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 import org.apache.solr.analysis.SolrAnalyzer;
 
 import java.util.Map;
@@ -44,7 +44,8 @@ public class BoolField extends FieldType
     return getStringSort(field,reverse);
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     return new OrdFieldSource(field.name);
   }
 
@@ -128,10 +129,6 @@ public class BoolField extends FieldType
     }
   }
 
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeBool(name, f.stringValue().charAt(0) =='T');
-  }
-
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     writer.writeBool(name, f.stringValue().charAt(0) =='T');
   }

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/ByteField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/ByteField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/ByteField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/ByteField.java Wed Jan  5 20:25:17 2011
@@ -22,7 +22,7 @@ import org.apache.lucene.search.cache.By
 import org.apache.lucene.search.cache.CachedArrayCreator;
 
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.ByteFieldSource;
 
@@ -42,15 +42,11 @@ public class ByteField extends FieldType
     return new SortField(field.name, SortField.BYTE, reverse);
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     return new ByteFieldSource( new ByteValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) );
   }
 
-
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeByte(name, f.stringValue());
-  }
-
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     String s = f.stringValue();
 
@@ -67,7 +63,7 @@ public class ByteField extends FieldType
 
     try {
       byte val = Byte.parseByte(s);
-      writer.writeByte(name, val);
+      writer.writeInt(name, val);
     } catch (NumberFormatException e){
       // can't parse - write out the contents as a string so nothing is lost and
       // clients don't get a parse error.

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/CoordinateFieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/CoordinateFieldType.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/CoordinateFieldType.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/CoordinateFieldType.java Wed Jan  5 20:25:17 2011
@@ -17,21 +17,6 @@
 
 package org.apache.solr.schema;
 
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.index.Term;
-import org.apache.solr.search.QParser;
-import org.apache.solr.search.function.ValueSource;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.params.MapSolrParams;
-
-import java.util.Map;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-
 /**
  * A CoordinateFieldType is the base class for {@link org.apache.solr.schema.FieldType}s that have semantics
  * related to items in a coordinate system.

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/DateField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/DateField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/DateField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/DateField.java Wed Jan  5 20:25:17 2011
@@ -28,7 +28,6 @@ import org.apache.solr.common.SolrExcept
 import org.apache.solr.common.util.DateUtil;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.*;
 import org.apache.solr.util.ByteUtils;
@@ -220,10 +219,6 @@ public class DateField extends FieldType
     return new OrdFieldSource(field.name);
   }
 
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeDate(name, toExternal(f));
-  }
-
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     writer.writeDate(name, toExternal(f));
   }

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/DoubleField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/DoubleField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/DoubleField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/DoubleField.java Wed Jan  5 20:25:17 2011
@@ -21,11 +21,9 @@ import org.apache.lucene.document.Fielda
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 import org.apache.lucene.search.cache.DoubleValuesCreator;
-import org.apache.lucene.search.cache.FloatValuesCreator;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.DoubleFieldSource;
-import org.apache.solr.search.function.FloatFieldSource;
 import org.apache.solr.search.function.ValueSource;
 
 import java.io.IOException;
@@ -44,15 +42,12 @@ public class DoubleField extends FieldTy
     return new SortField(field.name, SortField.DOUBLE, reverse);
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     // fieldCache doesn't support double
     return new DoubleFieldSource( new DoubleValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) );
   }
 
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeDouble(name, f.stringValue());
-  }
-
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     String s = f.stringValue();
 

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/ExternalFileField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/ExternalFileField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/ExternalFileField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/ExternalFileField.java Wed Jan  5 20:25:17 2011
@@ -19,11 +19,9 @@ package org.apache.solr.schema;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.document.Fieldable;
 import org.apache.solr.search.function.ValueSource;
-import org.apache.solr.search.function.FloatFieldSource;
 import org.apache.solr.search.function.FileFloatSource;
 import org.apache.solr.search.QParser;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 import org.apache.solr.common.SolrException;
 
 import java.util.Map;
@@ -76,10 +74,6 @@ public class ExternalFileField extends F
     this.schema = schema;
   }
 
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    throw new UnsupportedOperationException();
-  }
-
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     throw new UnsupportedOperationException();
   }

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/FieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/FieldType.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/FieldType.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/FieldType.java Wed Jan  5 20:25:17 2011
@@ -17,42 +17,34 @@
 
 package org.apache.solr.schema;
 
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.Tokenizer;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
-import org.apache.lucene.search.SortField;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.index.Term;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermRangeQuery;
+import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.index.Term;
+import org.apache.lucene.search.TermRangeQuery;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.UnicodeUtil;
 import org.apache.noggit.CharArr;
-import org.apache.solr.search.function.ValueSource;
-import org.apache.solr.search.function.OrdFieldSource;
-import org.apache.solr.search.Sorting;
-import org.apache.solr.search.QParser;
-import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 import org.apache.solr.analysis.SolrAnalyzer;
 import org.apache.solr.common.SolrException;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.params.MapSolrParams;
-
+import org.apache.solr.response.TextResponseWriter;
+import org.apache.solr.search.QParser;
+import org.apache.solr.search.Sorting;
+import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.util.ByteUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.ArrayList;
-import java.io.Reader;
+
 import java.io.IOException;
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Base class for all field types used by an index schema.
@@ -229,7 +221,7 @@ public abstract class FieldType extends 
    *
    *
    */
-  public Field createField(SchemaField field, String externalVal, float boost) {
+  public Fieldable createField(SchemaField field, String externalVal, float boost) {
     if (!field.indexed() && !field.stored()) {
       if (log.isTraceEnabled())
         log.trace("Ignoring unindexed/unstored field: " + field);
@@ -260,9 +252,9 @@ public abstract class FieldType extends 
    * @param omitNorms true if norms should be omitted
    * @param omitTFPos true if term freq and position should be omitted.
    * @param boost The boost value
-   * @return the {@link org.apache.lucene.document.Field}.
+   * @return the {@link org.apache.lucene.document.Fieldable}.
    */
-  protected Field createField(String name, String val, Field.Store storage, Field.Index index,
+  protected Fieldable createField(String name, String val, Field.Store storage, Field.Index index,
                                     Field.TermVector vec, boolean omitNorms, boolean omitTFPos, float boost){
     Field f = new Field(name,
                         val,
@@ -286,7 +278,7 @@ public abstract class FieldType extends 
    * @see #isPolyField()
    */
   public Fieldable[] createFields(SchemaField field, String externalVal, float boost) {
-    Field f = createField( field, externalVal, boost);
+    Fieldable f = createField( field, externalVal, boost);
     return f==null ? new Fieldable[]{} : new Fieldable[]{f};
   }
 
@@ -349,7 +341,7 @@ public abstract class FieldType extends 
   public Object toObject(SchemaField sf, BytesRef term) {
     CharArr ext = new CharArr(term.length);
     indexedToReadable(term, ext);
-    Field f = createField(sf, ext.toString(), 1.0f);
+    Fieldable f = createField(sf, ext.toString(), 1.0f);
     return toObject(f);
   }
 
@@ -476,11 +468,6 @@ public abstract class FieldType extends 
   }
 
   /**
-   * Renders the specified field as XML
-   */
-  public abstract void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException;
-
-  /**
    * calls back to TextResponseWriter to write the field value
    */
   public abstract void write(TextResponseWriter writer, String name, Fieldable f) throws IOException;
@@ -503,19 +490,10 @@ public abstract class FieldType extends 
    *  Lucene FieldCache.)
    */
   public ValueSource getValueSource(SchemaField field, QParser parser) {
-    return getValueSource(field);
-  }
-
-
-  /**
-   * @deprecated use {@link #getValueSource(SchemaField, QParser)}
-   */
-  @Deprecated
-  public ValueSource getValueSource(SchemaField field) {
-    // return new OrdFieldSource(field.name);
     return new StrFieldSource(field.name);
   }
 
+
   /**
    * Returns a Query instance for doing range searches on this field type. {@link org.apache.solr.search.SolrQueryParser}
    * currently passes part1 and part2 as null if they are '*' respectively. minInclusive and maxInclusive are both true
@@ -533,7 +511,6 @@ public abstract class FieldType extends 
    * @param maxInclusive whether the maximum of the range is inclusive or not
    *  @return a Query instance to perform range search according to given parameters
    *
-   * @see org.apache.solr.search.SolrQueryParser#getRangeQuery(String, String, String, boolean)
    */
   public Query getRangeQuery(QParser parser, SchemaField field, String part1, String part2, boolean minInclusive, boolean maxInclusive) {
     // constant score mode is now enabled per default
@@ -553,6 +530,8 @@ public abstract class FieldType extends 
    * 
    */
   public Query getFieldQuery(QParser parser, SchemaField field, String externalVal) {
-    return new TermQuery(new Term(field.getName(), toInternal(externalVal)));
+    BytesRef br = new BytesRef();
+    readableToIndexed(externalVal, br);
+    return new TermQuery(new Term(field.getName(), br));
   }
 }

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/FloatField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/FloatField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/FloatField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/FloatField.java Wed Jan  5 20:25:17 2011
@@ -20,13 +20,11 @@ package org.apache.solr.schema;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 import org.apache.lucene.search.cache.FloatValuesCreator;
-import org.apache.lucene.search.cache.LongValuesCreator;
-import org.apache.solr.search.function.LongFieldSource;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.FloatFieldSource;
 import org.apache.lucene.document.Fieldable;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 
 import java.util.Map;
 import java.io.IOException;
@@ -42,14 +40,11 @@ public class FloatField extends FieldTyp
     return new SortField(field.name,SortField.FLOAT, reverse);
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     return new FloatFieldSource( new FloatValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) );
   }
 
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeFloat(name, f.stringValue());
-  }
-
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     String s = f.stringValue();
 

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/GeoHashField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/GeoHashField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/GeoHashField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/GeoHashField.java Wed Jan  5 20:25:17 2011
@@ -25,7 +25,6 @@ import org.apache.lucene.spatial.Distanc
 import org.apache.lucene.spatial.tier.InvalidGeoException;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.SolrConstantScoreQuery;
 import org.apache.solr.search.SpatialOptions;
@@ -69,12 +68,6 @@ public class GeoHashField extends FieldT
   }
 
   @Override
-  public void write(XMLWriter xmlWriter, String name, Fieldable f)
-          throws IOException {
-    xmlWriter.writeStr(name, toExternal(f));
-  }
-
-  @Override
   public void write(TextResponseWriter writer, String name, Fieldable f)
           throws IOException {
     writer.writeStr(name, toExternal(f), false);

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/IndexSchema.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/IndexSchema.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/IndexSchema.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/IndexSchema.java Wed Jan  5 20:25:17 2011
@@ -92,17 +92,7 @@ public final class IndexSchema {
    */
   private Map<SchemaField, Integer> copyFieldTargetCounts
     = new HashMap<SchemaField, Integer>();
-  /**
-   * Constructs a schema using the specified file name using the normal
-   * Config path directory searching rules.
-   *
-   * @see Config#openResource
-   * @deprecated Use {@link #IndexSchema(SolrConfig, String, InputStream)} instead.
-   */
-  @Deprecated
-  public IndexSchema(SolrConfig solrConfig, String name) {
-    this(solrConfig, name, null);
-  }
+
     /**
    * Constructs a schema using the specified resource name and stream.
    * If the is stream is null, the resource loader will load the schema resource by name.
@@ -128,14 +118,6 @@ public final class IndexSchema {
     }
     loader.inform( loader );
   }
-
-  /**
-   * @deprecated -- get access to SolrConfig some other way...
-   */
-  @Deprecated
-  public SolrConfig getSolrConfig() {
-    return solrConfig;
-  }
   
   /**
    * @since solr 1.4
@@ -158,31 +140,7 @@ public final class IndexSchema {
   float getVersion() {
     return version;
   }
-  
-  /**
-   * Direct access to the InputStream for the schemaFile used by this instance.
-   * @see Config#openResource
-   * @deprecated Use {@link #getSolrConfig()} and open a resource input stream
-   *             for {@link #getResourceName()} instead.
-   */
-  @Deprecated
-  public InputStream getInputStream() {
-    return loader.openResource(resourceName);
-  }
 
-  /** Gets the name of the schema file.
-   * @deprecated Use {@link #getResourceName()} instead.
-   */
-  @Deprecated
-  public String getSchemaFile() {
-    return resourceName;
-  }
-
-  /** The Name of this schema (as specified in the schema file)
-   * @deprecated Use {@link #getSchemaName()} instead.
-   */
-  @Deprecated
-  public String getName() { return name; }
 
   /**
    * Provides direct access to the Map containing all explicit
@@ -265,24 +223,6 @@ public final class IndexSchema {
    */
   public Analyzer getQueryAnalyzer() { return queryAnalyzer; }
 
-
-
-  /**
-   * A SolrQueryParser linked to this IndexSchema for field datatype
-   * information, and populated with default options from the
-   * &lt;solrQueryParser&gt; configuration for this IndexSchema.
-   *
-   * @param defaultField if non-null overrides the schema default
-   * @deprecated
-   */
-  @Deprecated
-  public SolrQueryParser getSolrQueryParser(String defaultField) {
-    SolrQueryParser qp = new SolrQueryParser(this,defaultField);
-    String operator = getQueryParserDefaultOperator();
-    qp.setDefaultOperator("AND".equals(operator) ?
-                          QueryParser.Operator.AND : QueryParser.Operator.OR);
-    return qp;
-  }
   
   /**
    * Name of the default search field specified in the schema file
@@ -293,9 +233,7 @@ public final class IndexSchema {
 
   /**
    * default operator ("AND" or "OR") for QueryParser
-   * @deprecated use getSolrQueryParser().getDefaultOperator()
    */
-  @Deprecated
   public String getQueryParserDefaultOperator() {
     return queryParserDefaultOperator;
   }
@@ -1278,37 +1216,6 @@ public final class IndexSchema {
     }
     return sf.toArray(new SchemaField[sf.size()]);
   }
-  /**
-   * Get all copy fields, both the static and the dynamic ones.
-   * 
-   * @param sourceField
-   * @return Array of fields to copy to.
-   * @deprecated Use {@link #getCopyFieldsList(String)} instead.
-   */
-  @Deprecated
-  public SchemaField[] getCopyFields(String sourceField) {
-    // This is the List that holds all the results, dynamic or not.
-    List<SchemaField> matchCopyFields = new ArrayList<SchemaField>();
-
-    // Get the dynamic results into the list.
-    for(DynamicCopy dynamicCopy : dynamicCopyFields) {
-      if(dynamicCopy.matches(sourceField)) {
-        matchCopyFields.add(dynamicCopy.getTargetField(sourceField));
-      }
-    }
-
-    // Get the fixed ones, if there are any and add them.
-    final List<CopyField> copyFields = copyFieldsMap.get(sourceField);
-    if (copyFields!=null) {
-      final Iterator<CopyField> it = copyFields.iterator();
-      while (it.hasNext()) {
-        matchCopyFields.add(it.next().getDestination());
-      }
-    }
-
-    // Construct the results by transforming the list into an array.
-    return matchCopyFields.toArray(new SchemaField[matchCopyFields.size()]);
-  }
 
   /**
    * Get all copy fields for a specified source field, both static

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/IntField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/IntField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/IntField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/IntField.java Wed Jan  5 20:25:17 2011
@@ -20,11 +20,11 @@ package org.apache.solr.schema;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 import org.apache.lucene.search.cache.IntValuesCreator;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.IntFieldSource;
 import org.apache.lucene.document.Fieldable;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 
 import java.util.Map;
 import java.io.IOException;
@@ -40,14 +40,11 @@ public class IntField extends FieldType 
     return new SortField(field.name,SortField.INT, reverse);
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     return new IntFieldSource(new IntValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) );
   }
 
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeInt(name, f.stringValue());
-  }
-
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     String s = f.stringValue();
 

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/LatLonType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/LatLonType.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/LatLonType.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/LatLonType.java Wed Jan  5 20:25:17 2011
@@ -26,7 +26,6 @@ import org.apache.lucene.spatial.tier.In
 import org.apache.lucene.util.Bits;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.SolrIndexReader;
 import org.apache.solr.search.SpatialOptions;
@@ -268,11 +267,6 @@ public class LatLonType extends Abstract
   }
 
   @Override
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeStr(name, f.stringValue());
-  }
-
-  @Override
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     writer.writeStr(name, f.stringValue(), false);
   }
@@ -287,7 +281,7 @@ public class LatLonType extends Abstract
   //It never makes sense to create a single field, so make it impossible to happen
 
   @Override
-  public Field createField(SchemaField field, String externalVal, float boost) {
+  public Fieldable createField(SchemaField field, String externalVal, float boost) {
     throw new UnsupportedOperationException("LatLonType uses multiple fields.  field=" + field.getName());
   }
 
@@ -340,13 +334,13 @@ class SpatialDistanceQuery extends Query
   public void extractTerms(Set terms) {}
 
   protected class SpatialWeight extends Weight {
-    protected Searcher searcher;
+    protected IndexSearcher searcher;
     protected float queryNorm;
     protected float queryWeight;
     protected Map latContext;
     protected Map lonContext;
 
-    public SpatialWeight(Searcher searcher) throws IOException {
+    public SpatialWeight(IndexSearcher searcher) throws IOException {
       this.searcher = searcher;
       this.latContext = latSource.newContext();
       this.lonContext = lonSource.newContext();
@@ -541,7 +535,7 @@ class SpatialDistanceQuery extends Query
 
 
   @Override
-  public Weight createWeight(Searcher searcher) throws IOException {
+  public Weight createWeight(IndexSearcher searcher) throws IOException {
     return new SpatialWeight(searcher);
   }
 

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/LongField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/LongField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/LongField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/LongField.java Wed Jan  5 20:25:17 2011
@@ -19,12 +19,10 @@ package org.apache.solr.schema;
 
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.search.SortField;
-import org.apache.lucene.search.cache.ByteValuesCreator;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 import org.apache.lucene.search.cache.LongValuesCreator;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
-import org.apache.solr.search.function.IntFieldSource;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.LongFieldSource;
 
@@ -45,15 +43,11 @@ public class LongField extends FieldType
     return new SortField(field.name,SortField.LONG, reverse);
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     return new LongFieldSource( new LongValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) );
   }
 
-
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeLong(name, f.stringValue());
-  }
-
   @Override
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     String s = f.stringValue();

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/PointType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/PointType.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/PointType.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/PointType.java Wed Jan  5 20:25:17 2011
@@ -29,7 +29,6 @@ import org.apache.solr.common.SolrExcept
 import org.apache.solr.common.params.MapSolrParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.SpatialOptions;
 import org.apache.solr.search.function.VectorValueSource;
@@ -113,16 +112,11 @@ public class PointType extends Coordinat
    *
    */
   @Override
-  public Field createField(SchemaField field, String externalVal, float boost) {
+  public Fieldable createField(SchemaField field, String externalVal, float boost) {
     throw new UnsupportedOperationException("PointType uses multiple fields.  field=" + field.getName());
   }
 
   @Override
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeStr(name, f.stringValue());
-  }
-
-  @Override
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     writer.writeStr(name, f.stringValue(), false);
   }

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/RandomSortField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/RandomSortField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/RandomSortField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/RandomSortField.java Wed Jan  5 20:25:17 2011
@@ -24,7 +24,7 @@ import org.apache.lucene.document.Fielda
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.*;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.DocValues;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.SolrIndexReader;
@@ -96,14 +96,11 @@ public class RandomSortField extends Fie
   }
 
   @Override
-  public ValueSource getValueSource(SchemaField field) {
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     return new RandomValueSource(field.getName());
   }
 
   @Override
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException { }
-
-  @Override
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException { }
 
 

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SchemaField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SchemaField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SchemaField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SchemaField.java Wed Jan  5 20:25:17 2011
@@ -21,7 +21,6 @@ import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.search.SortField;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 
 import java.util.Map;
 import java.io.IOException;
@@ -90,7 +89,7 @@ public final class SchemaField extends F
   boolean isBinary() { return (properties & BINARY)!=0; }
 
 
-  public Field createField(String val, float boost) {
+  public Fieldable createField(String val, float boost) {
     return type.createField(this,val,boost);
   }
   
@@ -116,11 +115,6 @@ public final class SchemaField extends F
       + "}";
   }
 
-  public void write(XMLWriter writer, String name, Fieldable val) throws IOException {
-    // name is passed in because it may be null if name should not be used.
-    type.write(writer,name,val);
-  }
-
   public void write(TextResponseWriter writer, String name, Fieldable val) throws IOException {
     // name is passed in because it may be null if name should not be used.
     type.write(writer,name,val);

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/ShortField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/ShortField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/ShortField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/ShortField.java Wed Jan  5 20:25:17 2011
@@ -18,12 +18,11 @@ package org.apache.solr.schema;
 
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.search.SortField;
-import org.apache.lucene.search.cache.CachedArray;
 import org.apache.lucene.search.cache.CachedArrayCreator;
 import org.apache.lucene.search.cache.ShortValuesCreator;
 
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.ShortFieldSource;
 
@@ -47,16 +46,12 @@ public class ShortField extends FieldTyp
     return new SortField(field.name, SortField.SHORT, reverse);
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
 
     return new ShortFieldSource(new ShortValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) );
   }
 
-
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeShort(name, f.stringValue());
-  }
-
   @Override
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     String s = f.stringValue();
@@ -74,7 +69,7 @@ public class ShortField extends FieldTyp
 
     try {
       short val = Short.parseShort(s);
-      writer.writeShort(name, val);
+      writer.writeInt(name, val);
     } catch (NumberFormatException e){
       // can't parse - write out the contents as a string so nothing is lost and
       // clients don't get a parse error.

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableDoubleField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableDoubleField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableDoubleField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableDoubleField.java Wed Jan  5 20:25:17 2011
@@ -22,6 +22,7 @@ import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
 import org.apache.solr.search.MutableValueDouble;
 import org.apache.solr.search.MutableValue;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.FieldCacheSource;
 import org.apache.solr.search.function.DocValues;
@@ -31,7 +32,6 @@ import org.apache.lucene.index.IndexRead
 import org.apache.solr.util.ByteUtils;
 import org.apache.solr.util.NumberUtils;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 
 import java.util.Map;
 import java.io.IOException;
@@ -46,7 +46,8 @@ public class SortableDoubleField extends
     return getStringSort(field,reverse);
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     return new SortableDoubleFieldSource(field.name);
   }
 
@@ -73,11 +74,6 @@ public class SortableDoubleField extends
     out.write( indexedToReadable(ByteUtils.UTF8toUTF16(input)) );
   }
 
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    String sval = f.stringValue();
-    xmlWriter.writeDouble(name, NumberUtils.SortableStr2double(sval));
-  }
-
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     String sval = f.stringValue();
     writer.writeDouble(name, NumberUtils.SortableStr2double(sval));

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableFloatField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableFloatField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableFloatField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableFloatField.java Wed Jan  5 20:25:17 2011
@@ -22,6 +22,7 @@ import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
 import org.apache.solr.search.MutableValueFloat;
 import org.apache.solr.search.MutableValue;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.FieldCacheSource;
 import org.apache.solr.search.function.DocValues;
@@ -31,7 +32,6 @@ import org.apache.lucene.index.IndexRead
 import org.apache.solr.util.ByteUtils;
 import org.apache.solr.util.NumberUtils;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 
 import java.util.Map;
 import java.io.IOException;
@@ -46,7 +46,8 @@ public class SortableFloatField extends 
     return getStringSort(field,reverse);
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     return new SortableFloatFieldSource(field.name);
   }
 
@@ -72,11 +73,6 @@ public class SortableFloatField extends 
     // TODO: this could be more efficient, but the sortable types should be deprecated instead
     out.write( indexedToReadable(ByteUtils.UTF8toUTF16(input)) );
   }
-  
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    String sval = f.stringValue();
-    xmlWriter.writeFloat(name, NumberUtils.SortableStr2float(sval));
-  }
 
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     String sval = f.stringValue();

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableIntField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableIntField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableIntField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableIntField.java Wed Jan  5 20:25:17 2011
@@ -22,6 +22,7 @@ import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
 import org.apache.solr.search.MutableValueInt;
 import org.apache.solr.search.MutableValue;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.FieldCacheSource;
 import org.apache.solr.search.function.DocValues;
@@ -31,7 +32,6 @@ import org.apache.lucene.index.IndexRead
 import org.apache.solr.util.ByteUtils;
 import org.apache.solr.util.NumberUtils;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 
 import java.util.Map;
 import java.io.IOException;
@@ -46,7 +46,8 @@ public class SortableIntField extends Fi
     return getStringSort(field,reverse);
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     return new SortableIntFieldSource(field.name);
   }
 
@@ -75,13 +76,6 @@ public class SortableIntField extends Fi
   public Integer toObject(Fieldable f) {
     return NumberUtils.SortableStr2int(f.stringValue(), 0, 3);    
   }
-  
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    String sval = f.stringValue();
-    // since writeInt an int instead of a String since that may be more efficient
-    // in the future (saves the construction of one String)
-    xmlWriter.writeInt(name, NumberUtils.SortableStr2int(sval,0,sval.length()));
-  }
 
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     String sval = f.stringValue();

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableLongField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableLongField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableLongField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableLongField.java Wed Jan  5 20:25:17 2011
@@ -22,6 +22,7 @@ import org.apache.lucene.util.BytesRef;
 import org.apache.noggit.CharArr;
 import org.apache.solr.search.MutableValueLong;
 import org.apache.solr.search.MutableValue;
+import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.FieldCacheSource;
 import org.apache.solr.search.function.DocValues;
@@ -31,7 +32,6 @@ import org.apache.lucene.index.IndexRead
 import org.apache.solr.util.ByteUtils;
 import org.apache.solr.util.NumberUtils;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 
 import java.util.Map;
 import java.io.IOException;
@@ -46,7 +46,8 @@ public class SortableLongField extends F
     return getStringSort(field,reverse);
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     return new SortableLongFieldSource(field.name);
   }
 
@@ -72,11 +73,6 @@ public class SortableLongField extends F
   public Long toObject(Fieldable f) {
     return NumberUtils.SortableStr2long(f.stringValue(),0,5);
   }
-  
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    String sval = f.stringValue();
-    xmlWriter.writeLong(name, NumberUtils.SortableStr2long(sval,0,sval.length()));
-  }
 
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     String sval = f.stringValue();

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SpatialQueryable.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SpatialQueryable.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SpatialQueryable.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SpatialQueryable.java Wed Jan  5 20:25:17 2011
@@ -17,7 +17,6 @@ package org.apache.solr.schema;
  */
 
 
-import org.apache.lucene.search.Filter;
 import org.apache.lucene.search.Query;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.SpatialOptions;

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrField.java Wed Jan  5 20:25:17 2011
@@ -19,14 +19,9 @@ package org.apache.solr.schema;
 
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.document.Fieldable;
-import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.util.BytesRef;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 import org.apache.solr.search.function.ValueSource;
-import org.apache.solr.search.function.FieldCacheSource;
-import org.apache.solr.search.function.DocValues;
-import org.apache.solr.search.function.StringIndexDocValues;
 import org.apache.solr.search.QParser;
 import org.apache.solr.util.ByteUtils;
 
@@ -44,10 +39,6 @@ public class StrField extends FieldType 
     return getStringSort(field,reverse);
   }
 
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeStr(name, f.stringValue());
-  }
-
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     writer.writeStr(name, f.stringValue(), true);
   }

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TextField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TextField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TextField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TextField.java Wed Jan  5 20:25:17 2011
@@ -33,7 +33,6 @@ import org.apache.lucene.analysis.TokenS
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.util.BytesRef;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 import org.apache.solr.search.QParser;
 import org.apache.solr.util.ByteUtils;
 
@@ -67,10 +66,6 @@ public class TextField extends FieldType
     return getStringSort(field, reverse);
   }
 
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    xmlWriter.writeStr(name, f.stringValue());
-  }
-
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     writer.writeStr(name, f.stringValue(), true);
   }

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieDateField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieDateField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieDateField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieDateField.java Wed Jan  5 20:25:17 2011
@@ -26,7 +26,6 @@ import org.apache.solr.analysis.TrieToke
 import org.apache.solr.search.function.*;
 import org.apache.solr.search.QParser;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.search.SortField;
@@ -93,17 +92,6 @@ public class TrieDateField extends DateF
   }
 
   @Override
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    byte[] arr = f.getBinaryValue();
-    if (arr==null) {
-      xmlWriter.writeStr(name, TrieField.badFieldString(f));
-      return;
-    }
-
-    xmlWriter.writeDate(name,new Date(TrieField.toLong(arr)));
-  }
-
-  @Override
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     byte[] arr = f.getBinaryValue();
     if (arr==null) {
@@ -172,7 +160,7 @@ public class TrieDateField extends DateF
   }
 
   @Override
-  public Field createField(SchemaField field, String externalVal, float boost) {
+  public Fieldable createField(SchemaField field, String externalVal, float boost) {
     boolean indexed = field.indexed();
     boolean stored = field.stored();
 

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieField.java Wed Jan  5 20:25:17 2011
@@ -32,7 +32,6 @@ import org.apache.noggit.CharArr;
 import org.apache.solr.analysis.*;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 import org.apache.solr.search.MutableValueDate;
 import org.apache.solr.search.MutableValueLong;
 import org.apache.solr.search.QParser;
@@ -175,7 +174,8 @@ public class TrieField extends FieldType
     }
   }
 
-  public ValueSource getValueSource(SchemaField field) {
+  @Override
+  public ValueSource getValueSource(SchemaField field, QParser qparser) {
     int flags = CachedArrayCreator.CACHE_VALUES_AND_BITS;
     switch (type) {
       case INTEGER:
@@ -193,33 +193,6 @@ public class TrieField extends FieldType
     }
   }
 
-  public void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException {
-    byte[] arr = f.getBinaryValue();
-    if (arr==null) {
-      xmlWriter.writeStr(name, badFieldString(f));
-      return;
-    }
-
-    switch (type) {
-      case INTEGER:
-        xmlWriter.writeInt(name,toInt(arr));
-        break;
-      case FLOAT:
-        xmlWriter.writeFloat(name,toFloat(arr));
-        break;
-      case LONG:
-        xmlWriter.writeLong(name,toLong(arr));
-        break;
-      case DOUBLE:
-        xmlWriter.writeDouble(name,toDouble(arr));
-        break;
-      case DATE:
-        xmlWriter.writeDate(name,new Date(toLong(arr)));
-        break;
-      default:
-        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field: " + f.name());
-    }
-  }
 
   public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
     byte[] arr = f.getBinaryValue();
@@ -504,7 +477,7 @@ public class TrieField extends FieldType
   }
 
   @Override
-  public Field createField(SchemaField field, String externalVal, float boost) {
+  public Fieldable createField(SchemaField field, String externalVal, float boost) {
     boolean indexed = field.indexed();
     boolean stored = field.stored();
 

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/UUIDField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/UUIDField.java?rev=1055622&r1=1055621&r2=1055622&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/UUIDField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/UUIDField.java Wed Jan  5 20:25:17 2011
@@ -26,7 +26,6 @@ import org.apache.lucene.document.Fielda
 import org.apache.lucene.search.SortField;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.response.TextResponseWriter;
-import org.apache.solr.response.XMLWriter;
 
 /**
  * This FieldType accepts UUID string values, as well as the special value 
@@ -36,7 +35,7 @@ import org.apache.solr.response.XMLWrite
  * @see UUID#randomUUID
  * @version $Id$
  */
-public class UUIDField extends FieldType {
+public class UUIDField extends StrField {
   private static final String NEW = "NEW";
   private static final char DASH='-';
 
@@ -54,12 +53,6 @@ public class UUIDField extends FieldType
   }
 
   @Override
-  public void write(XMLWriter xmlWriter, String name, Fieldable f)
-      throws IOException {
-    xmlWriter.writeStr(name, f.stringValue());
-  }
-
-  @Override
   public void write(TextResponseWriter writer, String name, Fieldable f)
       throws IOException {
     writer.writeStr(name, f.stringValue(), false);



Mime
View raw message