You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by yo...@apache.org on 2006/03/21 16:36:42 UTC

svn commit: r387550 [2/4] - in /lucene/java/trunk: ./ contrib/analyzers/src/java/org/apache/lucene/analysis/br/ contrib/analyzers/src/java/org/apache/lucene/analysis/cz/ contrib/analyzers/src/java/org/apache/lucene/analysis/de/ contrib/analyzers/src/ja...

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/BooleanClause.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/BooleanClause.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/BooleanClause.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/BooleanClause.java Tue Mar 21 07:36:32 2006
@@ -49,57 +49,18 @@
   }
 
   /** The query whose matching documents are combined by the boolean query.
-   *     @deprecated use {@link #setQuery(Query)} instead */
-  public Query query;    // TODO: decrease visibility for Lucene 2.0
-
-  /** If true, documents documents which <i>do not</i>
-    match this sub-query will <i>not</i> match the boolean query.
-    @deprecated use {@link #setOccur(BooleanClause.Occur)} instead */
-  public boolean required = false;  // TODO: decrease visibility for Lucene 2.0
-  
-  /** If true, documents documents which <i>do</i>
-    match this sub-query will <i>not</i> match the boolean query.
-    @deprecated use {@link #setOccur(BooleanClause.Occur)} instead */
-  public boolean prohibited = false;  // TODO: decrease visibility for Lucene 2.0
+   */
+  private Query query;    // TODO: decrease visibility for Lucene 2.0
 
   private Occur occur = Occur.SHOULD;
 
-  /** Constructs a BooleanClause with query <code>q</code>, required
-   * <code>r</code> and prohibited <code>p</code>.
-   * @deprecated use BooleanClause(Query, Occur) instead
-   * <ul>
-   *  <li>For BooleanClause(query, true, false) use BooleanClause(query, BooleanClause.Occur.MUST)
-   *  <li>For BooleanClause(query, false, false) use BooleanClause(query, BooleanClause.Occur.SHOULD)
-   *  <li>For BooleanClause(query, false, true) use BooleanClause(query, BooleanClause.Occur.MUST_NOT)
-   * </ul>
-   */ 
-  public BooleanClause(Query q, boolean r, boolean p) {
-    // TODO: remove for Lucene 2.0
-    query = q;
-    required = r;
-    prohibited = p;
-    if (required) {
-      if (prohibited) {
-        // prohibited && required doesn't make sense, but we want the old behaviour:
-        occur = Occur.MUST_NOT;
-      } else {
-         occur = Occur.MUST;
-      }
-    } else {
-      if (prohibited) {
-         occur = Occur.MUST_NOT;
-      } else {
-         occur = Occur.SHOULD;
-      }
-    }
-  }
 
   /** Constructs a BooleanClause.
   */ 
   public BooleanClause(Query query, Occur occur) {
     this.query = query;
     this.occur = occur;
-    setFields(occur);
+    
   }
 
   public Occur getOccur() {
@@ -108,7 +69,7 @@
 
   public void setOccur(Occur occur) {
     this.occur = occur;
-    setFields(occur);
+
   }
 
   public Query getQuery() {
@@ -120,27 +81,14 @@
   }
   
   public boolean isProhibited() {
-    return prohibited;
+    return Occur.MUST_NOT.equals(occur);
   }
 
   public boolean isRequired() {
-    return required;
+    return Occur.MUST.equals(occur);
   }
 
-  private void setFields(Occur occur) {
-    if (occur == Occur.MUST) {
-      required = true;
-      prohibited = false;
-    } else if (occur == Occur.SHOULD) {
-      required = false;
-      prohibited = false;
-    } else if (occur == Occur.MUST_NOT) {
-      required = false;
-      prohibited = true;
-    } else {
-      throw new IllegalArgumentException("Unknown operator " + occur);
-    }
-  }
+
 
   /** Returns true iff <code>o</code> is equal to this. */
   public boolean equals(Object o) {
@@ -148,13 +96,12 @@
       return false;
     BooleanClause other = (BooleanClause)o;
     return this.query.equals(other.query)
-      && (this.required == other.required)
-      && (this.prohibited == other.prohibited);
+      && this.occur.equals(other.occur);
   }
 
   /** Returns a hash code value for this object.*/
   public int hashCode() {
-    return query.hashCode() ^ (this.required?1:0) ^ (this.prohibited?2:0);
+    return query.hashCode() ^ (Occur.MUST.equals(occur)?1:0) ^ (Occur.MUST_NOT.equals(occur)?2:0);
   }
 
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java Tue Mar 21 07:36:32 2006
@@ -16,14 +16,14 @@
  * limitations under the License.
  */
 
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.util.ToStringUtils;
+
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.Vector;
 
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.util.ToStringUtils;
-
 /** A Query that matches documents matching boolean combinations of other
   * queries, e.g. {@link TermQuery}s, {@link PhraseQuery}s or other
   * BooleanQuerys.
@@ -31,9 +31,9 @@
 public class BooleanQuery extends Query {
 
   /**
-   * @deprecated use {@link #setMaxClauseCount(int)} instead
+
    */
-  public static int maxClauseCount = 1024;
+  private static int maxClauseCount = 1024;
 
   /** Thrown when an attempt is made to add more than {@link
    * #getMaxClauseCount()} clauses. This typically happens if
@@ -140,30 +140,6 @@
    */
   public int getMinimumNumberShouldMatch() {
     return minNrShouldMatch;
-  }
-
-  /** Adds a clause to a boolean query.  Clauses may be:
-   * <ul>
-   * <li><code>required</code> which means that documents which <i>do not</i>
-   * match this sub-query will <i>not</i> match the boolean query;
-   * <li><code>prohibited</code> which means that documents which <i>do</i>
-   * match this sub-query will <i>not</i> match the boolean query; or
-   * <li>neither, in which case matched documents are neither prohibited from
-   * nor required to match the sub-query. However, a document must match at
-   * least 1 sub-query to match the boolean query.
-   * </ul>
-   * It is an error to specify a clause as both <code>required</code> and
-   * <code>prohibited</code>.
-   *
-   * @deprecated use {@link #add(Query, BooleanClause.Occur)} instead:
-   * <ul>
-   *  <li>For add(query, true, false) use add(query, BooleanClause.Occur.MUST)
-   *  <li>For add(query, false, false) use add(query, BooleanClause.Occur.SHOULD)
-   *  <li>For add(query, false, true) use add(query, BooleanClause.Occur.MUST_NOT)
-   * </ul>
-   */
-  public void add(Query query, boolean required, boolean prohibited) {
-    add(new BooleanClause(query, required, prohibited));
   }
 
   /** Adds a clause to a boolean query.

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/DateFilter.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/DateFilter.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/DateFilter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/DateFilter.java Tue Mar 21 07:36:32 2006
@@ -1,148 +0,0 @@
-package org.apache.lucene.search;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.BitSet;
-import java.util.Date;
-import java.io.IOException;
-
-import org.apache.lucene.document.DateField;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermDocs;
-import org.apache.lucene.index.TermEnum;
-import org.apache.lucene.index.IndexReader;
-
-/**
- * A Filter that restricts search results to a range of time.
- *
- * <p>For this to work, documents must have been indexed with a
- * {@link DateField}.</p>
- * 
- * @deprecated Instead, use {@link RangeFilter} combined with 
- *             {@link org.apache.lucene.document.DateTools}.
- */
-public class DateFilter extends Filter {
-  String field;
-
-  String start = DateField.MIN_DATE_STRING();
-  String end = DateField.MAX_DATE_STRING();
-
-  private DateFilter(String f) {
-    field = f;
-  }
-
-  /**
-   * Constructs a filter for field <code>f</code> matching dates
-   * between <code>from</code> and <code>to</code> inclusively.
-   */
-  public DateFilter(String f, Date from, Date to) {
-    field = f;
-    start = DateField.dateToString(from);
-    end = DateField.dateToString(to);
-  }
-
-  /**
-   * Constructs a filter for field <code>f</code> matching times
-   * between <code>from</code> and <code>to</code> inclusively.
-   */
-  public DateFilter(String f, long from, long to) {
-    field = f;
-    start = DateField.timeToString(from);
-    end = DateField.timeToString(to);
-  }
-
-  /**
-   * Constructs a filter for field <code>f</code> matching
-   * dates on or before before <code>date</code>.
-   */
-  public static DateFilter Before(String field, Date date) {
-    DateFilter result = new DateFilter(field);
-    result.end = DateField.dateToString(date);
-    return result;
-  }
-
-  /**
-   * Constructs a filter for field <code>f</code> matching times
-   * on or before <code>time</code>.
-   */
-  public static DateFilter Before(String field, long time) {
-    DateFilter result = new DateFilter(field);
-    result.end = DateField.timeToString(time);
-    return result;
-  }
-
-  /**
-   * Constructs a filter for field <code>f</code> matching
-   * dates on or after <code>date</code>.
-   */
-  public static DateFilter After(String field, Date date) {
-    DateFilter result = new DateFilter(field);
-    result.start = DateField.dateToString(date);
-    return result;
-  }
-
-  /**
-   * Constructs a filter for field <code>f</code> matching
-   * times on or after <code>time</code>.
-   */
-  public static DateFilter After(String field, long time) {
-    DateFilter result = new DateFilter(field);
-    result.start = DateField.timeToString(time);
-    return result;
-  }
-
-  /**
-   * Returns a BitSet with true for documents which should be
-   * permitted in search results, and false for those that should
-   * not.
-   */
-  public BitSet bits(IndexReader reader) throws IOException {
-    BitSet bits = new BitSet(reader.maxDoc());
-    TermEnum enumerator = reader.terms(new Term(field, start));
-    TermDocs termDocs = reader.termDocs();
-    if (enumerator.term() == null) {
-      return bits;
-    }
-
-    try {
-      Term stop = new Term(field, end);
-      while (enumerator.term().compareTo(stop) <= 0) {
-        termDocs.seek(enumerator.term());
-        while (termDocs.next()) {
-          bits.set(termDocs.doc());
-        }
-        if (!enumerator.next()) {
-          break;
-        }
-      }
-    } finally {
-      enumerator.close();
-      termDocs.close();
-    }
-    return bits;
-  }
-
-  public String toString() {
-    StringBuffer buffer = new StringBuffer();
-    buffer.append(field);
-    buffer.append(":");
-    buffer.append(DateField.stringToDate(start).toString());
-    buffer.append("-");
-    buffer.append(DateField.stringToDate(end).toString());
-    return buffer.toString();
-  }
-}

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/MultiSearcher.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/MultiSearcher.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/MultiSearcher.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/MultiSearcher.java Tue Mar 21 07:36:32 2006
@@ -146,12 +146,6 @@
     return searchables[i].doc(n - starts[i]);	  // dispatch to searcher
   }
 
-  /** Call {@link #subSearcher} instead.
-   * @deprecated
-   */
-  public int searcherIndex(int n) {
-    return subSearcher(n);
-  }
 
   /** Returns index of the searcher for document <code>n</code> in the array
    * used to construct this searcher. */

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/PhrasePrefixQuery.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/PhrasePrefixQuery.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/PhrasePrefixQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/PhrasePrefixQuery.java Tue Mar 21 07:36:32 2006
@@ -1,273 +0,0 @@
-package org.apache.lucene.search;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.MultipleTermPositions;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermPositions;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.util.ToStringUtils;
-
-/**
- * PhrasePrefixQuery is a generalized version of PhraseQuery, with an added
- * method {@link #add(Term[])}.
- * To use this class, to search for the phrase "Microsoft app*" first use
- * add(Term) on the term "Microsoft", then find all terms that has "app" as
- * prefix using IndexReader.terms(Term), and use PhrasePrefixQuery.add(Term[]
- * terms) to add them to the query.
- * 
- * @deprecated use {@link org.apache.lucene.search.MultiPhraseQuery} instead
- * @author Anders Nielsen
- * @version 1.0
- */
-public class PhrasePrefixQuery extends Query {
-  private String field;
-  private ArrayList termArrays = new ArrayList();
-  private Vector positions = new Vector();
-
-  private int slop = 0;
-
-  /** Sets the phrase slop for this query.
-   * @see PhraseQuery#setSlop(int)
-   */
-  public void setSlop(int s) { slop = s; }
-
-  /** Sets the phrase slop for this query.
-   * @see PhraseQuery#getSlop()
-   */
-  public int getSlop() { return slop; }
-
-  /** Add a single term at the next position in the phrase.
-   * @see PhraseQuery#add(Term)
-   */
-  public void add(Term term) { add(new Term[]{term}); }
-
-  /** Add multiple terms at the next position in the phrase.  Any of the terms
-   * may match.
-   *
-   * @see PhraseQuery#add(Term)
-   */
-  public void add(Term[] terms) {
-    int position = 0;
-    if (positions.size() > 0)
-      position = ((Integer) positions.lastElement()).intValue() + 1;
-
-    add(terms, position);
-  }
-
-  /**
-   * Allows to specify the relative position of terms within the phrase.
-   * 
-   * @see PhraseQuery#add(Term, int)
-   * @param terms
-   * @param position
-   */
-  public void add(Term[] terms, int position) {
-    if (termArrays.size() == 0)
-      field = terms[0].field();
-
-    for (int i = 0; i < terms.length; i++) {
-      if (terms[i].field() != field) {
-        throw new IllegalArgumentException(
-            "All phrase terms must be in the same field (" + field + "): "
-                + terms[i]);
-      }
-    }
-
-    termArrays.add(terms);
-    positions.addElement(new Integer(position));
-  }
-
-  /**
-   * Returns the relative positions of terms in this phrase.
-   */
-  public int[] getPositions() {
-    int[] result = new int[positions.size()];
-    for (int i = 0; i < positions.size(); i++)
-      result[i] = ((Integer) positions.elementAt(i)).intValue();
-    return result;
-  }
-
-  private class PhrasePrefixWeight implements Weight {
-    private Similarity similarity;
-    private float value;
-    private float idf;
-    private float queryNorm;
-    private float queryWeight;
-
-    public PhrasePrefixWeight(Searcher searcher)
-      throws IOException {
-      this.similarity = getSimilarity(searcher);
-
-      // compute idf
-      Iterator i = termArrays.iterator();
-      while (i.hasNext()) {
-        Term[] terms = (Term[])i.next();
-        for (int j=0; j<terms.length; j++) {
-          idf += getSimilarity(searcher).idf(terms[j], searcher);
-        }
-      }
-    }
-
-    public Query getQuery() { return PhrasePrefixQuery.this; }
-    public float getValue() { return value; }
-
-    public float sumOfSquaredWeights() {
-      queryWeight = idf * getBoost();             // compute query weight
-      return queryWeight * queryWeight;           // square it
-    }
-
-    public void normalize(float queryNorm) {
-      this.queryNorm = queryNorm;
-      queryWeight *= queryNorm;                   // normalize query weight
-      value = queryWeight * idf;                  // idf for document 
-    }
-
-    public Scorer scorer(IndexReader reader) throws IOException {
-      if (termArrays.size() == 0)                  // optimize zero-term case
-        return null;
-
-      TermPositions[] tps = new TermPositions[termArrays.size()];
-      for (int i=0; i<tps.length; i++) {
-        Term[] terms = (Term[])termArrays.get(i);
-
-        TermPositions p;
-        if (terms.length > 1)
-          p = new MultipleTermPositions(reader, terms);
-        else
-          p = reader.termPositions(terms[0]);
-
-        if (p == null)
-          return null;
-
-        tps[i] = p;
-      }
-
-      if (slop == 0)
-        return new ExactPhraseScorer(this, tps, getPositions(), similarity,
-                                     reader.norms(field));
-      else
-        return new SloppyPhraseScorer(this, tps, getPositions(), similarity,
-                                      slop, reader.norms(field));
-    }
-
-    public Explanation explain(IndexReader reader, int doc)
-      throws IOException {
-      Explanation result = new Explanation();
-      result.setDescription("weight("+getQuery()+" in "+doc+"), product of:");
-
-      Explanation idfExpl = new Explanation(idf, "idf("+getQuery()+")");
-
-      // explain query weight
-      Explanation queryExpl = new Explanation();
-      queryExpl.setDescription("queryWeight(" + getQuery() + "), product of:");
-
-      Explanation boostExpl = new Explanation(getBoost(), "boost");
-      if (getBoost() != 1.0f)
-        queryExpl.addDetail(boostExpl);
-
-      queryExpl.addDetail(idfExpl);
-
-      Explanation queryNormExpl = new Explanation(queryNorm,"queryNorm");
-      queryExpl.addDetail(queryNormExpl);
-
-      queryExpl.setValue(boostExpl.getValue() *
-                         idfExpl.getValue() *
-                         queryNormExpl.getValue());
-
-      result.addDetail(queryExpl);
-
-      // explain field weight
-      Explanation fieldExpl = new Explanation();
-      fieldExpl.setDescription("fieldWeight("+getQuery()+" in "+doc+
-                               "), product of:");
-
-      Explanation tfExpl = scorer(reader).explain(doc);
-      fieldExpl.addDetail(tfExpl);
-      fieldExpl.addDetail(idfExpl);
-
-      Explanation fieldNormExpl = new Explanation();
-      byte[] fieldNorms = reader.norms(field);
-      float fieldNorm =
-        fieldNorms!=null ? Similarity.decodeNorm(fieldNorms[doc]) : 0.0f;
-      fieldNormExpl.setValue(fieldNorm);
-      fieldNormExpl.setDescription("fieldNorm(field="+field+", doc="+doc+")");
-      fieldExpl.addDetail(fieldNormExpl);
-
-      fieldExpl.setValue(tfExpl.getValue() *
-                         idfExpl.getValue() *
-                         fieldNormExpl.getValue());
-
-      result.addDetail(fieldExpl);
-
-      // combine them
-      result.setValue(queryExpl.getValue() * fieldExpl.getValue());
-
-      if (queryExpl.getValue() == 1.0f)
-        return fieldExpl;
-
-      return result;
-    }
-  }
-
-  protected Weight createWeight(Searcher searcher) throws IOException {
-    if (termArrays.size() == 1) {                 // optimize one-term case
-      Term[] terms = (Term[])termArrays.get(0);
-      BooleanQuery boq = new BooleanQuery(true);
-      for (int i=0; i<terms.length; i++) {
-        boq.add(new TermQuery(terms[i]), BooleanClause.Occur.SHOULD);
-      }
-      boq.setBoost(getBoost());
-      return boq.createWeight(searcher);
-    }
-    return new PhrasePrefixWeight(searcher);
-  }
-
-  /** Prints a user-readable version of this query. */
-  public final String toString(String f) {
-    StringBuffer buffer = new StringBuffer();
-    if (!field.equals(f)) {
-      buffer.append(field);
-      buffer.append(":");
-    }
-
-    buffer.append("\"");
-    Iterator i = termArrays.iterator();
-    while (i.hasNext()) {
-      Term[] terms = (Term[])i.next();
-      buffer.append(terms[0].text() + (terms.length > 1 ? "*" : ""));
-      if (i.hasNext())
-        buffer.append(" ");
-    }
-    buffer.append("\"");
-
-    if (slop != 0) {
-      buffer.append("~");
-      buffer.append(slop);
-    }
-
-    buffer.append(ToStringUtils.boost(getBoost()));
-
-    return buffer.toString();
-  }
-}

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/RangeFilter.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/RangeFilter.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/RangeFilter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/RangeFilter.java Tue Mar 21 07:36:32 2006
@@ -16,14 +16,13 @@
  * limitations under the License.
  */
 
-import java.util.BitSet;
-import java.io.IOException;
-
-import org.apache.lucene.search.Filter;
+import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;
 import org.apache.lucene.index.TermEnum;
-import org.apache.lucene.index.IndexReader;
+
+import java.io.IOException;
+import java.util.BitSet;
 
 /**
  * A Filter that restricts search results to a range of values in a given
@@ -31,7 +30,7 @@
  * 
  * <p>
  * This code borrows heavily from {@link RangeQuery}, but is implemented as a Filter
- * (much like {@link DateFilter}).
+ * 
  * </p>
  */
 public class RangeFilter extends Filter {

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/RemoteSearchable.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/RemoteSearchable.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/RemoteSearchable.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/RemoteSearchable.java Tue Mar 21 07:36:32 2006
@@ -16,16 +16,15 @@
  * limitations under the License.
  */
 
-import java.io.IOException;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.index.Term;
 
+import java.io.IOException;
 import java.rmi.Naming;
-import java.rmi.RemoteException;
 import java.rmi.RMISecurityManager;
+import java.rmi.RemoteException;
 import java.rmi.server.UnicastRemoteObject;
 
-import org.apache.lucene.document.Document;
-import org.apache.lucene.index.Term;
-
 /**
  * A remote searchable implementation.
  *
@@ -42,13 +41,7 @@
     super();
     this.local = local;
   }
-  
-  // this implementation should be removed when the deprecated
-  // Searchable#search(Query,Filter,HitCollector) is removed
-  public void search(Query query, Filter filter, HitCollector results)
-    throws IOException {
-    local.search(query, filter, results);
-  }
+
 
   public void search(Weight weight, Filter filter, HitCollector results)
     throws IOException {
@@ -72,22 +65,10 @@
     return local.maxDoc();
   }
 
-  // this implementation should be removed when the deprecated
-  // Searchable#search(Query,Filter,int) is removed
-  public TopDocs search(Query query, Filter filter, int n) throws IOException {
-    return local.search(query, filter, n);
-  }
-
   public TopDocs search(Weight weight, Filter filter, int n) throws IOException {
     return local.search(weight, filter, n);
   }
 
-  // this implementation should be removed when the deprecated
-  // Searchable#search(Query,Filter,int,Sort) is removed
-  public TopFieldDocs search (Query query, Filter filter, int n, Sort sort)
-    throws IOException {
-    return local.search (query, filter, n, sort);
-  }
 
   public TopFieldDocs search (Weight weight, Filter filter, int n, Sort sort)
   throws IOException {
@@ -100,12 +81,6 @@
 
   public Query rewrite(Query original) throws IOException {
     return local.rewrite(original);
-  }
-
-  // this implementation should be removed when the deprecated
-  // Searchable#explain(Query,int) is removed
-  public Explanation explain(Query query, int doc) throws IOException {
-    return local.explain(query, doc);
   }
 
   public Explanation explain(Weight weight, int doc) throws IOException {

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/Searchable.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/Searchable.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/Searchable.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/Searchable.java Tue Mar 21 07:36:32 2006
@@ -16,11 +16,11 @@
  * limitations under the License.
  */
 
-import java.io.IOException;
-
 import org.apache.lucene.document.Document;
+import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.index.IndexReader;       // for javadoc
+
+import java.io.IOException;       // for javadoc
 
 /** The interface for search implementations.
  *
@@ -52,11 +52,6 @@
   void search(Weight weight, Filter filter, HitCollector results)
   throws IOException;
 
-  /** Expert: Low-level search implementation.
-   * @deprecated use {@link Searcher#search(Weight, Filter, HitCollector)} instead.
-   */
-  void search(Query query, Filter filter, HitCollector results)
-    throws IOException;
 
   /** Frees resources associated with this Searcher.
    * Be careful not to call this method while you are still using objects
@@ -93,11 +88,6 @@
    */
   TopDocs search(Weight weight, Filter filter, int n) throws IOException;
 
-  /** Expert: Low-level search implementation.
-   * @deprecated use {@link Searcher#search(Weight, Filter, int)} instead.
-   */
-  TopDocs search(Query query, Filter filter, int n) throws IOException;
-
   /** Expert: Returns the stored fields of document <code>i</code>.
    * Called by {@link HitCollector} implementations.
    * @see IndexReader#document(int)
@@ -122,11 +112,6 @@
    */
   Explanation explain(Weight weight, int doc) throws IOException;
 
-  /**
-   * @deprecated use {@link Searcher#explain(Weight, int)} instead.
-   */
-  Explanation explain(Query query, int doc) throws IOException;
-
   /** Expert: Low-level search implementation with arbitrary sorting.  Finds
    * the top <code>n</code> hits for <code>query</code>, applying
    * <code>filter</code> if non-null, and sorting the hits by the criteria in
@@ -139,9 +124,4 @@
   TopFieldDocs search(Weight weight, Filter filter, int n, Sort sort)
   throws IOException;
 
-  /** Expert: Low-level search implementation.
-   * @deprecated use {@link Searcher#search(Weight, Filter, int, Sort)} instead.
-   */
-  TopFieldDocs search(Query query, Filter filter, int n, Sort sort)
-    throws IOException;
 }

Modified: lucene/java/trunk/src/java/org/apache/lucene/store/Directory.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/store/Directory.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/store/Directory.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/store/Directory.java Tue Mar 21 07:36:32 2006
@@ -62,31 +62,15 @@
   public abstract long fileLength(String name)
        throws IOException;
 
-  /** @deprecated use {@link #createOutput(String)} */
-  public OutputStream createFile(String name) throws IOException {
-    return (OutputStream)createOutput(name);
-  }
 
   /** Creates a new, empty file in the directory with the given name.
       Returns a stream writing this file. */
-  public IndexOutput createOutput(String name) throws IOException {
-    // default implementation for back compatibility
-    // this method should be abstract
-    return (IndexOutput)createFile(name);
-  }
+  public abstract IndexOutput createOutput(String name) throws IOException;
 
-  /** @deprecated use {@link #openInput(String)} */
-  public InputStream openFile(String name) throws IOException {
-    return (InputStream)openInput(name);
-  }
 
   /** Returns a stream reading an existing file. */
-  public IndexInput openInput(String name)
-    throws IOException {
-    // default implementation for back compatibility
-    // this method should be abstract
-    return (IndexInput)openFile(name);
-  }
+  public abstract IndexInput openInput(String name)
+    throws IOException;
 
   /** Construct a {@link Lock}.
    * @param name the name of the lock file

Modified: lucene/java/trunk/src/java/org/apache/lucene/store/InputStream.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/store/InputStream.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/store/InputStream.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/store/InputStream.java Tue Mar 21 07:36:32 2006
@@ -1,28 +0,0 @@
-package org.apache.lucene.store;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** @deprecated Use {@link IndexInput} or {@link BufferedIndexInput} instead.*/
-public abstract class InputStream extends BufferedIndexInput {
-
-  protected long length;			  // set by subclasses
-
-  public long length() {
-    return length;
-  }
-
-}

Modified: lucene/java/trunk/src/java/org/apache/lucene/store/Lock.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/store/Lock.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/store/Lock.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/store/Lock.java Tue Mar 21 07:36:32 2006
@@ -16,8 +16,6 @@
  * limitations under the License.
  */
 
-import org.apache.lucene.index.IndexWriter;
-
 import java.io.IOException;
 
 /** An interprocess mutex lock.
@@ -80,14 +78,6 @@
     private Lock lock;
     private long lockWaitTimeout;
 
-    /** Constructs an executor that will grab the named lock.
-     *  Defaults lockWaitTimeout to Lock.COMMIT_LOCK_TIMEOUT.
-     *  @deprecated Kept only to avoid breaking existing code.
-     */
-    public With(Lock lock)
-    {
-      this(lock, IndexWriter.COMMIT_LOCK_TIMEOUT);
-    }
 
     /** Constructs an executor that will grab the named lock. */
     public With(Lock lock, long lockWaitTimeout) {

Modified: lucene/java/trunk/src/java/org/apache/lucene/store/OutputStream.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/store/OutputStream.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/store/OutputStream.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/store/OutputStream.java Tue Mar 21 07:36:32 2006
@@ -1,22 +0,0 @@
-package org.apache.lucene.store;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** @deprecated Use {@link IndexOutput} or {@link BufferedIndexOutput}
- * instead.*/
-public abstract class OutputStream extends BufferedIndexOutput {
-}

Modified: lucene/java/trunk/src/test-deprecated/org/apache/lucene/analysis/TestAnalyzers.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test-deprecated/org/apache/lucene/analysis/TestAnalyzers.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/test-deprecated/org/apache/lucene/analysis/TestAnalyzers.java (original)
+++ lucene/java/trunk/src/test-deprecated/org/apache/lucene/analysis/TestAnalyzers.java Tue Mar 21 07:36:32 2006
@@ -1,92 +0,0 @@
-package org.apache.lucene.analysis;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.*;
-import junit.framework.*;
-
-import org.apache.lucene.*;
-import org.apache.lucene.analysis.*;
-
-public class TestAnalyzers extends TestCase {
-
-   public TestAnalyzers(String name) {
-      super(name);
-   }
-
-  public void assertAnalyzesTo(Analyzer a, 
-                               String input, 
-                               String[] output) throws Exception {
-    TokenStream ts = a.tokenStream("dummy", new StringReader(input));
-    for (int i=0; i<output.length; i++) {
-      Token t = ts.next();
-      assertNotNull(t);
-      assertEquals(t.termText(), output[i]);
-    }
-    assertNull(ts.next());
-    ts.close();
-  }
-
-  public void testSimple() throws Exception {
-    Analyzer a = new SimpleAnalyzer();
-    assertAnalyzesTo(a, "foo bar FOO BAR", 
-                     new String[] { "foo", "bar", "foo", "bar" });
-    assertAnalyzesTo(a, "foo      bar .  FOO <> BAR", 
-                     new String[] { "foo", "bar", "foo", "bar" });
-    assertAnalyzesTo(a, "foo.bar.FOO.BAR", 
-                     new String[] { "foo", "bar", "foo", "bar" });
-    assertAnalyzesTo(a, "U.S.A.", 
-                     new String[] { "u", "s", "a" });
-    assertAnalyzesTo(a, "C++", 
-                     new String[] { "c" });
-    assertAnalyzesTo(a, "B2B", 
-                     new String[] { "b", "b" });
-    assertAnalyzesTo(a, "2B", 
-                     new String[] { "b" });
-    assertAnalyzesTo(a, "\"QUOTED\" word", 
-                     new String[] { "quoted", "word" });
-  }
-
-  public void testNull() throws Exception {
-    Analyzer a = new WhitespaceAnalyzer();
-    assertAnalyzesTo(a, "foo bar FOO BAR", 
-                     new String[] { "foo", "bar", "FOO", "BAR" });
-    assertAnalyzesTo(a, "foo      bar .  FOO <> BAR", 
-                     new String[] { "foo", "bar", ".", "FOO", "<>", "BAR" });
-    assertAnalyzesTo(a, "foo.bar.FOO.BAR", 
-                     new String[] { "foo.bar.FOO.BAR" });
-    assertAnalyzesTo(a, "U.S.A.", 
-                     new String[] { "U.S.A." });
-    assertAnalyzesTo(a, "C++", 
-                     new String[] { "C++" });
-    assertAnalyzesTo(a, "B2B", 
-                     new String[] { "B2B" });
-    assertAnalyzesTo(a, "2B", 
-                     new String[] { "2B" });
-    assertAnalyzesTo(a, "\"QUOTED\" word", 
-                     new String[] { "\"QUOTED\"", "word" });
-  }
-
-  public void testStop() throws Exception {
-    Analyzer a = new StopAnalyzer();
-    assertAnalyzesTo(a, "foo bar FOO BAR", 
-                     new String[] { "foo", "bar", "foo", "bar" });
-    assertAnalyzesTo(a, "foo a bar such FOO THESE BAR", 
-                     new String[] { "foo", "bar", "foo", "bar" });
-  }
-}
-

Modified: lucene/java/trunk/src/test-deprecated/org/apache/lucene/analysis/TestPerFieldAnalzyerWrapper.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test-deprecated/org/apache/lucene/analysis/TestPerFieldAnalzyerWrapper.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/test-deprecated/org/apache/lucene/analysis/TestPerFieldAnalzyerWrapper.java (original)
+++ lucene/java/trunk/src/test-deprecated/org/apache/lucene/analysis/TestPerFieldAnalzyerWrapper.java Tue Mar 21 07:36:32 2006
@@ -1,43 +0,0 @@
-package org.apache.lucene.analysis;
-
-import junit.framework.TestCase;
-import java.io.StringReader;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class TestPerFieldAnalzyerWrapper extends TestCase {
-  public void testPerField() throws Exception {
-    String text = "Qwerty";
-    PerFieldAnalyzerWrapper analyzer =
-              new PerFieldAnalyzerWrapper(new WhitespaceAnalyzer());
-    analyzer.addAnalyzer("special", new SimpleAnalyzer());
-
-    TokenStream tokenStream = analyzer.tokenStream("field",
-                                            new StringReader(text));
-    Token token = tokenStream.next();
-    assertEquals("WhitespaceAnalyzer does not lowercase",
-                 "Qwerty",
-                 token.termText());
-
-    tokenStream = analyzer.tokenStream("special",
-                                            new StringReader(text));
-    token = tokenStream.next();
-    assertEquals("SimpleAnalyzer lowercases",
-                 "qwerty",
-                 token.termText());
-  }
-}

Modified: lucene/java/trunk/src/test-deprecated/org/apache/lucene/analysis/TestStopAnalyzer.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test-deprecated/org/apache/lucene/analysis/TestStopAnalyzer.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/test-deprecated/org/apache/lucene/analysis/TestStopAnalyzer.java (original)
+++ lucene/java/trunk/src/test-deprecated/org/apache/lucene/analysis/TestStopAnalyzer.java Tue Mar 21 07:36:32 2006
@@ -1,76 +0,0 @@
-package org.apache.lucene.analysis;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import junit.framework.TestCase;
-
-import java.io.StringReader;
-import java.io.IOException;
-import java.util.Set;
-import java.util.HashSet;
-
-public class TestStopAnalyzer extends TestCase {
-  private StopAnalyzer stop = new StopAnalyzer();
-
-  private Set inValidTokens = new HashSet();
-  public TestStopAnalyzer(String s) {
-    super(s);
-  }
-
-  protected void setUp() {
-    for (int i = 0; i < StopAnalyzer.ENGLISH_STOP_WORDS.length; i++) {
-      inValidTokens.add(StopAnalyzer.ENGLISH_STOP_WORDS[i]);
-    }
-  }
-
-  public void testDefaults() {
-    assertTrue(stop != null);
-    StringReader reader = new StringReader("This is a test of the english stop analyzer");
-    TokenStream stream = stop.tokenStream("test", reader);
-    assertTrue(stream != null);
-    Token token = null;
-    try {
-      while ((token = stream.next()) != null)
-      {
-        assertTrue(inValidTokens.contains(token.termText()) == false);
-      }
-    } catch (IOException e) {
-      assertTrue(false);
-    }
-  }
-
-  public void testStopList() {
-    Set stopWordsSet = new HashSet();
-    stopWordsSet.add("good");
-    stopWordsSet.add("test");
-    stopWordsSet.add("analyzer");
-    StopAnalyzer newStop = new StopAnalyzer((String[])stopWordsSet.toArray(new String[3]));
-    StringReader reader = new StringReader("This is a good test of the english stop analyzer");
-    TokenStream stream = newStop.tokenStream("test", reader);
-    assertTrue(stream != null);
-    Token token = null;
-    try {
-      while ((token = stream.next()) != null)
-      {
-        String text = token.termText();
-        assertTrue(stopWordsSet.contains(text) == false);
-      }
-    } catch (IOException e) {
-      assertTrue(false);
-    }
-  }
-}

Modified: lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/MockInputStream.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/MockInputStream.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/MockInputStream.java (original)
+++ lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/MockInputStream.java Tue Mar 21 07:36:32 2006
@@ -1,56 +0,0 @@
-package org.apache.lucene.index;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.apache.lucene.store.InputStream;
-
-import java.io.IOException;
-
-public class MockInputStream extends InputStream {
-    private byte[] buffer;
-    private int pointer = 0;
-
-    public MockInputStream(byte[] bytes) {
-        buffer = bytes;
-        length = bytes.length;
-    }
-
-    protected void readInternal(byte[] dest, int destOffset, int len)
-            throws IOException {
-        int remainder = len;
-        int start = pointer;
-        while (remainder != 0) {
-//          int bufferNumber = start / buffer.length;
-          int bufferOffset = start % buffer.length;
-          int bytesInBuffer = buffer.length - bufferOffset;
-          int bytesToCopy = bytesInBuffer >= remainder ? remainder : bytesInBuffer;
-          System.arraycopy(buffer, bufferOffset, dest, destOffset, bytesToCopy);
-          destOffset += bytesToCopy;
-          start += bytesToCopy;
-          remainder -= bytesToCopy;
-        }
-        pointer += len;
-    }
-
-    public void close() throws IOException {
-        // ignore
-    }
-
-    protected void seekInternal(long pos) throws IOException {
-        pointer = (int) pos;
-    }
-}

Modified: lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TermInfosTest.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TermInfosTest.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TermInfosTest.java (original)
+++ lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TermInfosTest.java Tue Mar 21 07:36:32 2006
@@ -1,184 +0,0 @@
-package org.apache.lucene.index;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.FSDirectory;
-
-import java.util.Date;
-import java.util.Random;
-import java.util.Vector;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.File;
-import java.io.FileInputStream;
-
-class TermInfosTest {
-  public static void main(String[] args) {
-    try {
-      test();
-    } catch (Exception e) {
-      System.out.println(" caught a " + e.getClass() +
-			 "\n with message: " + e.getMessage());
-    }
-  }
-
-  // FIXME: OG: remove hard-coded file names
-  public static void test()
-       throws Exception {
-
-    File file = new File("words.txt");
-    System.out.println(" reading word file containing " +
-		       file.length() + " bytes");
-
-    Date start = new Date();
-
-    Vector keys = new Vector();
-    FileInputStream ws = new FileInputStream(file);
-    BufferedReader wr = new BufferedReader(new InputStreamReader(ws));
-
-    for (String key = wr.readLine(); key!=null; key = wr.readLine())
-      keys.addElement(new Term("word", key));
-    wr.close();
-
-    Date end = new Date();
-
-    System.out.print(end.getTime() - start.getTime());
-    System.out.println(" milliseconds to read " + keys.size() + " words");
-
-    start = new Date();
-
-    Random gen = new Random(1251971);
-    long fp = (gen.nextInt() & 0xF) + 1;
-    long pp = (gen.nextInt() & 0xF) + 1;
-    int[] docFreqs = new int[keys.size()];
-    long[] freqPointers = new long[keys.size()];
-    long[] proxPointers = new long[keys.size()];
-    for (int i = 0; i < keys.size(); i++) {
-      docFreqs[i] = (gen.nextInt() & 0xF) + 1;
-      freqPointers[i] = fp;
-      proxPointers[i] = pp;
-      fp += (gen.nextInt() & 0xF) + 1;;
-      pp += (gen.nextInt() & 0xF) + 1;;
-    }
-
-    end = new Date();
-
-    System.out.print(end.getTime() - start.getTime());
-    System.out.println(" milliseconds to generate values");
-
-    start = new Date();
-
-    Directory store = FSDirectory.getDirectory("test.store", true);
-    FieldInfos fis = new FieldInfos();
-
-    TermInfosWriter writer = new TermInfosWriter(store, "words", fis,
-    		IndexWriter.DEFAULT_TERM_INDEX_INTERVAL);
-    fis.add("word", false);
-
-    for (int i = 0; i < keys.size(); i++)
-      writer.add((Term)keys.elementAt(i),
-		 new TermInfo(docFreqs[i], freqPointers[i], proxPointers[i]));
-
-    writer.close();
-
-    end = new Date();
-
-    System.out.print(end.getTime() - start.getTime());
-    System.out.println(" milliseconds to write table");
-
-    System.out.println(" table occupies " +
-		       store.fileLength("words.tis") + " bytes");
-
-    start = new Date();
-
-    TermInfosReader reader = new TermInfosReader(store, "words", fis);
-
-    end = new Date();
-
-    System.out.print(end.getTime() - start.getTime());
-    System.out.println(" milliseconds to open table");
-
-    start = new Date();
-
-    SegmentTermEnum enumerator = reader.terms();
-    for (int i = 0; i < keys.size(); i++) {
-      enumerator.next();
-      Term key = (Term)keys.elementAt(i);
-      if (!key.equals(enumerator.term()))
-	throw new Exception("wrong term: " + enumerator.term()
-			    + ", expected: " + key
-			    + " at " + i);
-      TermInfo ti = enumerator.termInfo();
-      if (ti.docFreq != docFreqs[i])
-	throw
-	  new Exception("wrong value: " + Long.toString(ti.docFreq, 16)
-			+ ", expected: " + Long.toString(docFreqs[i], 16)
-			+ " at " + i);
-      if (ti.freqPointer != freqPointers[i])
-	throw
-	  new Exception("wrong value: " + Long.toString(ti.freqPointer, 16)
-			+ ", expected: " + Long.toString(freqPointers[i], 16)
-			+ " at " + i);
-      if (ti.proxPointer != proxPointers[i])
-	throw
-	  new Exception("wrong value: " + Long.toString(ti.proxPointer, 16)
-			+ ", expected: " + Long.toString(proxPointers[i], 16)
-			+ " at " + i);
-    }
-
-    end = new Date();
-
-    System.out.print(end.getTime() - start.getTime());
-    System.out.println(" milliseconds to iterate over " +
-		       keys.size() + " words");
-
-    start = new Date();
-
-    for (int i = 0; i < keys.size(); i++) {
-      Term key = (Term)keys.elementAt(i);
-      TermInfo ti = reader.get(key);
-      if (ti.docFreq != docFreqs[i])
-	throw
-	  new Exception("wrong value: " + Long.toString(ti.docFreq, 16)
-			+ ", expected: " + Long.toString(docFreqs[i], 16)
-			+ " at " + i);
-      if (ti.freqPointer != freqPointers[i])
-	throw
-	  new Exception("wrong value: " + Long.toString(ti.freqPointer, 16)
-			+ ", expected: " + Long.toString(freqPointers[i], 16)
-			+ " at " + i);
-      if (ti.proxPointer != proxPointers[i])
-	throw
-	  new Exception("wrong value: " + Long.toString(ti.proxPointer, 16)
-			+ ", expected: " + Long.toString(proxPointers[i], 16)
-			+ " at " + i);
-    }
-
-    end = new Date();
-
-    System.out.print((end.getTime() - start.getTime()) / (float)keys.size());
-    System.out.println(" average milliseconds per lookup");
-
-    TermEnum e = reader.terms(new Term("word", "azz"));
-    System.out.println("Word after azz is " + e.term().text);
-
-    reader.close();
-
-    store.close();
-  }
-}

Modified: lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestFieldsReader.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestFieldsReader.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestFieldsReader.java (original)
+++ lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestFieldsReader.java Tue Mar 21 07:36:32 2006
@@ -1,77 +0,0 @@
-package org.apache.lucene.index;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import junit.framework.TestCase;
-import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
-import org.apache.lucene.search.Similarity;
-
-import java.util.Map;
-import java.io.IOException;
-
-public class TestFieldsReader extends TestCase {
-  private RAMDirectory dir = new RAMDirectory();
-  private Document testDoc = new Document();
-  private FieldInfos fieldInfos = null;
-
-  public TestFieldsReader(String s) {
-    super(s);
-  }
-
-  protected void setUp() {
-    fieldInfos = new FieldInfos();
-    DocHelper.setupDoc(testDoc);
-    fieldInfos.add(testDoc);
-    DocumentWriter writer = new DocumentWriter(dir, new WhitespaceAnalyzer(),
-            Similarity.getDefault(), 50);
-    assertTrue(writer != null);
-    try {
-      writer.addDocument("test", testDoc);
-    }
-    catch (IOException e)
-    {
-      
-    }
-  }
-
-  protected void tearDown() {
-
-  }
-
-  public void test() {
-    assertTrue(dir != null);
-    assertTrue(fieldInfos != null);
-    try {
-      FieldsReader reader = new FieldsReader(dir, "test", fieldInfos);
-      assertTrue(reader != null);
-      assertTrue(reader.size() == 1);
-      Document doc = reader.doc(0);
-      assertTrue(doc != null);
-      assertTrue(doc.getField("textField1") != null);
-      Field field = doc.getField("textField2");
-      assertTrue(field != null);
-      assertTrue(field.isTermVectorStored() == true);
-      reader.close();
-    } catch (IOException e) {
-      e.printStackTrace();
-      assertTrue(false);
-    }
-  }
-}

Modified: lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestFilterIndexReader.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestFilterIndexReader.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestFilterIndexReader.java (original)
+++ lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestFilterIndexReader.java Tue Mar 21 07:36:32 2006
@@ -1,137 +0,0 @@
-package org.apache.lucene.index;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-import junit.framework.TestResult;
-
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Searcher;
-import org.apache.lucene.search.Hits;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.store.FSDirectory;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-
-import java.util.Collection;
-import java.io.IOException;
-
-public class TestFilterIndexReader extends TestCase {
-
-  private static class TestReader extends FilterIndexReader {
-
-     /** Filter that only permits terms containing 'e'.*/
-    private static class TestTermEnum extends FilterTermEnum {
-      public TestTermEnum(TermEnum termEnum)
-        throws IOException {
-        super(termEnum);
-      }
-
-      /** Scan for terms containing the letter 'e'.*/
-      public boolean next() throws IOException {
-        while (in.next()) {
-          if (in.term().text().indexOf('e') != -1)
-            return true;
-        }
-        return false;
-      }
-    }
-    
-    /** Filter that only returns odd numbered documents. */
-    private static class TestTermPositions extends FilterTermPositions {
-      public TestTermPositions(TermPositions in)
-        throws IOException {
-        super(in);
-      }
-
-      /** Scan for odd numbered documents. */
-      public boolean next() throws IOException {
-        while (in.next()) {
-          if ((in.doc() % 2) == 1)
-            return true;
-        }
-        return false;
-      }
-    }
-    
-    public TestReader(IndexReader reader) {
-      super(reader);
-    }
-
-    /** Filter terms with TestTermEnum. */
-    public TermEnum terms() throws IOException {
-      return new TestTermEnum(in.terms());
-    }
-
-    /** Filter positions with TestTermPositions. */
-    public TermPositions termPositions() throws IOException {
-      return new TestTermPositions(in.termPositions());
-    }
-  }
-
-
-  /** Main for running test case by itself. */
-  public static void main(String args[]) {
-    TestRunner.run (new TestSuite(TestIndexReader.class));
-  }
-    
-  /**
-   * Tests the IndexReader.getFieldNames implementation
-   * @throws Exception on error
-   */
-  public void testFilterIndexReader() throws Exception {
-    RAMDirectory directory = new RAMDirectory();
-    IndexWriter writer =
-      new IndexWriter(directory, new WhitespaceAnalyzer(), true);
-
-    Document d1 = new Document();
-    d1.add(Field.Text("default","one two"));
-    writer.addDocument(d1);
-
-    Document d2 = new Document();
-    d2.add(Field.Text("default","one three"));
-    writer.addDocument(d2);
-
-    Document d3 = new Document();
-    d3.add(Field.Text("default","two four"));
-    writer.addDocument(d3);
-
-    writer.close();
-
-    IndexReader reader = new TestReader(IndexReader.open(directory));
-
-    TermEnum terms = reader.terms();
-    while (terms.next()) {
-      assertTrue(terms.term().text().indexOf('e') != -1);
-    }
-    terms.close();
-    
-    TermPositions positions = reader.termPositions(new Term("default", "one"));
-    while (positions.next()) {
-      assertTrue((positions.doc() % 2) == 1);
-    }
-
-    reader.close();
-  }
-}

Modified: lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestIndexReader.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestIndexReader.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestIndexReader.java (original)
+++ lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestIndexReader.java Tue Mar 21 07:36:32 2006
@@ -1,448 +0,0 @@
-package org.apache.lucene.index;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.store.FSDirectory;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-
-import java.util.Collection;
-import java.io.IOException;
-import java.io.File;
-
-public class TestIndexReader extends TestCase
-{
-    /** Main for running test case by itself. */
-    public static void main(String args[]) {
-        TestRunner.run (new TestSuite(TestIndexReader.class));
-//        TestRunner.run (new TestIndexReader("testBasicDelete"));
-//        TestRunner.run (new TestIndexReader("testDeleteReaderWriterConflict"));
-//        TestRunner.run (new TestIndexReader("testDeleteReaderReaderConflict"));
-//        TestRunner.run (new TestIndexReader("testFilesOpenClose"));
-    }
-
-    public TestIndexReader(String name) {
-        super(name);
-    }
-
-
-    /**
-     * Tests the IndexReader.getFieldNames implementation
-     * @throws Exception on error
-     */
-    public void testGetFieldNames() throws Exception
-    {
-        RAMDirectory d = new RAMDirectory();
-        // set up writer
-        IndexWriter writer = new IndexWriter(d, new StandardAnalyzer(), true);
-        addDocumentWithFields(writer);
-        writer.close();
-        // set up reader
-        IndexReader reader = IndexReader.open(d);
-        Collection fieldNames = reader.getFieldNames();
-        assertTrue(fieldNames.contains("keyword"));
-        assertTrue(fieldNames.contains("text"));
-        assertTrue(fieldNames.contains("unindexed"));
-        assertTrue(fieldNames.contains("unstored"));
-        // add more documents
-        writer = new IndexWriter(d, new StandardAnalyzer(), false);
-        // want to get some more segments here
-        for (int i = 0; i < 5*writer.mergeFactor; i++)
-        {
-            addDocumentWithFields(writer);
-        }
-        // new fields are in some different segments (we hope)
-        for (int i = 0; i < 5*writer.mergeFactor; i++)
-        {
-            addDocumentWithDifferentFields(writer);
-        }
-        writer.close();
-        // verify fields again
-        reader = IndexReader.open(d);
-        fieldNames = reader.getFieldNames();
-        assertEquals(8, fieldNames.size());    // the following fields
-        assertTrue(fieldNames.contains("keyword"));
-        assertTrue(fieldNames.contains("text"));
-        assertTrue(fieldNames.contains("unindexed"));
-        assertTrue(fieldNames.contains("unstored"));
-        assertTrue(fieldNames.contains("keyword2"));
-        assertTrue(fieldNames.contains("text2"));
-        assertTrue(fieldNames.contains("unindexed2"));
-        assertTrue(fieldNames.contains("unstored2"));
-
-        // verify that only indexed fields were returned
-        Collection indexedFieldNames = reader.getFieldNames(true);
-        assertEquals(6, indexedFieldNames.size());
-        assertTrue(indexedFieldNames.contains("keyword"));
-        assertTrue(indexedFieldNames.contains("text"));
-        assertTrue(indexedFieldNames.contains("unstored"));
-        assertTrue(indexedFieldNames.contains("keyword2"));
-        assertTrue(indexedFieldNames.contains("text2"));
-        assertTrue(indexedFieldNames.contains("unstored2"));
-
-        // verify that only unindexed fields were returned
-        Collection unindexedFieldNames = reader.getFieldNames(false);
-        assertEquals(2, unindexedFieldNames.size());    // the following fields
-        assertTrue(unindexedFieldNames.contains("unindexed"));
-        assertTrue(unindexedFieldNames.contains("unindexed2"));
-    }
-
-
-    private void assertTermDocsCount(String msg,
-                                     IndexReader reader,
-                                     Term term,
-                                     int expected)
-    throws IOException
-    {
-        TermDocs tdocs = null;
-
-        try {
-            tdocs = reader.termDocs(term);
-            assertNotNull(msg + ", null TermDocs", tdocs);
-            int count = 0;
-            while(tdocs.next()) {
-                count++;
-            }
-            assertEquals(msg + ", count mismatch", expected, count);
-
-        } finally {
-            if (tdocs != null)
-                try { tdocs.close(); } catch (Exception e) { }
-        }
-
-    }
-
-
-
-    public void testBasicDelete() throws IOException
-    {
-        Directory dir = new RAMDirectory();
-
-        IndexWriter writer = null;
-        IndexReader reader = null;
-        Term searchTerm = new Term("content", "aaa");
-
-        //  add 100 documents with term : aaa
-        writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
-        for (int i = 0; i < 100; i++)
-        {
-            addDoc(writer, searchTerm.text());
-        }
-        writer.close();
-
-        // OPEN READER AT THIS POINT - this should fix the view of the
-        // index at the point of having 100 "aaa" documents and 0 "bbb"
-        reader = IndexReader.open(dir);
-        assertEquals("first docFreq", 100, reader.docFreq(searchTerm));
-        assertTermDocsCount("first reader", reader, searchTerm, 100);
-
-        // DELETE DOCUMENTS CONTAINING TERM: aaa
-        int deleted = 0;
-        reader = IndexReader.open(dir);
-        deleted = reader.delete(searchTerm);
-        assertEquals("deleted count", 100, deleted);
-        assertEquals("deleted docFreq", 100, reader.docFreq(searchTerm));
-        assertTermDocsCount("deleted termDocs", reader, searchTerm, 0);
-        reader.close();
-
-        // CREATE A NEW READER and re-test
-        reader = IndexReader.open(dir);
-        assertEquals("deleted docFreq", 100, reader.docFreq(searchTerm));
-        assertTermDocsCount("deleted termDocs", reader, searchTerm, 0);
-        reader.close();
-    }
-
-
-    public void testDeleteReaderWriterConflictUnoptimized() throws IOException{
-      deleteReaderWriterConflict(false);
-    }
-    
-    public void testDeleteReaderWriterConflictOptimized() throws IOException{
-        deleteReaderWriterConflict(true);
-    }
-
-    private void deleteReaderWriterConflict(boolean optimize) throws IOException
-    {
-        //Directory dir = new RAMDirectory();
-        Directory dir = getDirectory(true);
-
-        Term searchTerm = new Term("content", "aaa");
-        Term searchTerm2 = new Term("content", "bbb");
-
-        //  add 100 documents with term : aaa
-        IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
-        for (int i = 0; i < 100; i++)
-        {
-            addDoc(writer, searchTerm.text());
-        }
-        writer.close();
-
-        // OPEN READER AT THIS POINT - this should fix the view of the
-        // index at the point of having 100 "aaa" documents and 0 "bbb"
-        IndexReader reader = IndexReader.open(dir);
-        assertEquals("first docFreq", 100, reader.docFreq(searchTerm));
-        assertEquals("first docFreq", 0, reader.docFreq(searchTerm2));
-        assertTermDocsCount("first reader", reader, searchTerm, 100);
-        assertTermDocsCount("first reader", reader, searchTerm2, 0);
-
-        // add 100 documents with term : bbb
-        writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), false);
-        for (int i = 0; i < 100; i++)
-        {
-            addDoc(writer, searchTerm2.text());
-        }
-
-        // REQUEST OPTIMIZATION
-        // This causes a new segment to become current for all subsequent
-        // searchers. Because of this, deletions made via a previously open
-        // reader, which would be applied to that reader's segment, are lost
-        // for subsequent searchers/readers
-        if(optimize)
-          writer.optimize();
-        writer.close();
-
-        // The reader should not see the new data
-        assertEquals("first docFreq", 100, reader.docFreq(searchTerm));
-        assertEquals("first docFreq", 0, reader.docFreq(searchTerm2));
-        assertTermDocsCount("first reader", reader, searchTerm, 100);
-        assertTermDocsCount("first reader", reader, searchTerm2, 0);
-
-
-        // DELETE DOCUMENTS CONTAINING TERM: aaa
-        // NOTE: the reader was created when only "aaa" documents were in
-        int deleted = 0;
-        try {
-            deleted = reader.delete(searchTerm);
-            fail("Delete allowed on an index reader with stale segment information");
-        } catch (IOException e) {
-            /* success */
-        }
-
-        // Re-open index reader and try again. This time it should see
-        // the new data.
-        reader.close();
-        reader = IndexReader.open(dir);
-        assertEquals("first docFreq", 100, reader.docFreq(searchTerm));
-        assertEquals("first docFreq", 100, reader.docFreq(searchTerm2));
-        assertTermDocsCount("first reader", reader, searchTerm, 100);
-        assertTermDocsCount("first reader", reader, searchTerm2, 100);
-
-        deleted = reader.delete(searchTerm);
-        assertEquals("deleted count", 100, deleted);
-        assertEquals("deleted docFreq", 100, reader.docFreq(searchTerm));
-        assertEquals("deleted docFreq", 100, reader.docFreq(searchTerm2));
-        assertTermDocsCount("deleted termDocs", reader, searchTerm, 0);
-        assertTermDocsCount("deleted termDocs", reader, searchTerm2, 100);
-        reader.close();
-
-        // CREATE A NEW READER and re-test
-        reader = IndexReader.open(dir);
-        assertEquals("deleted docFreq", 100, reader.docFreq(searchTerm));
-        assertEquals("deleted docFreq", 100, reader.docFreq(searchTerm2));
-        assertTermDocsCount("deleted termDocs", reader, searchTerm, 0);
-        assertTermDocsCount("deleted termDocs", reader, searchTerm2, 100);
-        reader.close();
-    }
-
-  private Directory getDirectory(boolean create) throws IOException {
-    return FSDirectory.getDirectory(new File(System.getProperty("tempDir"), "testIndex"), create);
-  }
-
-  public void testFilesOpenClose() throws IOException
-    {
-        // Create initial data set
-        Directory dir = getDirectory(true);
-        IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
-        addDoc(writer, "test");
-        writer.close();
-        dir.close();
-
-        // Try to erase the data - this ensures that the writer closed all files
-        dir = getDirectory(true);
-
-        // Now create the data set again, just as before
-        writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
-        addDoc(writer, "test");
-        writer.close();
-        dir.close();
-
-        // Now open existing directory and test that reader closes all files
-        dir = getDirectory(false);
-        IndexReader reader1 = IndexReader.open(dir);
-        reader1.close();
-        dir.close();
-
-        // The following will fail if reader did not close all files
-        dir = getDirectory(true);
-    }
-
-    public void testDeleteReaderReaderConflictUnoptimized() throws IOException{
-      deleteReaderReaderConflict(false);
-    }
-    
-    public void testDeleteReaderReaderConflictOptimized() throws IOException{
-      deleteReaderReaderConflict(true);
-    }
-    
-    private void deleteReaderReaderConflict(boolean optimize) throws IOException
-    {
-        Directory dir = getDirectory(true);
-
-        Term searchTerm1 = new Term("content", "aaa");
-        Term searchTerm2 = new Term("content", "bbb");
-        Term searchTerm3 = new Term("content", "ccc");
-
-        //  add 100 documents with term : aaa
-        //  add 100 documents with term : bbb
-        //  add 100 documents with term : ccc
-        IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
-        for (int i = 0; i < 100; i++)
-        {
-            addDoc(writer, searchTerm1.text());
-            addDoc(writer, searchTerm2.text());
-            addDoc(writer, searchTerm3.text());
-        }
-        if(optimize)
-          writer.optimize();
-        writer.close();
-
-        // OPEN TWO READERS
-        // Both readers get segment info as exists at this time
-        IndexReader reader1 = IndexReader.open(dir);
-        assertEquals("first opened", 100, reader1.docFreq(searchTerm1));
-        assertEquals("first opened", 100, reader1.docFreq(searchTerm2));
-        assertEquals("first opened", 100, reader1.docFreq(searchTerm3));
-        assertTermDocsCount("first opened", reader1, searchTerm1, 100);
-        assertTermDocsCount("first opened", reader1, searchTerm2, 100);
-        assertTermDocsCount("first opened", reader1, searchTerm3, 100);
-
-        IndexReader reader2 = IndexReader.open(dir);
-        assertEquals("first opened", 100, reader2.docFreq(searchTerm1));
-        assertEquals("first opened", 100, reader2.docFreq(searchTerm2));
-        assertEquals("first opened", 100, reader2.docFreq(searchTerm3));
-        assertTermDocsCount("first opened", reader2, searchTerm1, 100);
-        assertTermDocsCount("first opened", reader2, searchTerm2, 100);
-        assertTermDocsCount("first opened", reader2, searchTerm3, 100);
-
-        // DELETE DOCS FROM READER 2 and CLOSE IT
-        // delete documents containing term: aaa
-        // when the reader is closed, the segment info is updated and
-        // the first reader is now stale
-        reader2.delete(searchTerm1);
-        assertEquals("after delete 1", 100, reader2.docFreq(searchTerm1));
-        assertEquals("after delete 1", 100, reader2.docFreq(searchTerm2));
-        assertEquals("after delete 1", 100, reader2.docFreq(searchTerm3));
-        assertTermDocsCount("after delete 1", reader2, searchTerm1, 0);
-        assertTermDocsCount("after delete 1", reader2, searchTerm2, 100);
-        assertTermDocsCount("after delete 1", reader2, searchTerm3, 100);
-        reader2.close();
-
-        // Make sure reader 1 is unchanged since it was open earlier
-        assertEquals("after delete 1", 100, reader1.docFreq(searchTerm1));
-        assertEquals("after delete 1", 100, reader1.docFreq(searchTerm2));
-        assertEquals("after delete 1", 100, reader1.docFreq(searchTerm3));
-        assertTermDocsCount("after delete 1", reader1, searchTerm1, 100);
-        assertTermDocsCount("after delete 1", reader1, searchTerm2, 100);
-        assertTermDocsCount("after delete 1", reader1, searchTerm3, 100);
-
-
-        // ATTEMPT TO DELETE FROM STALE READER
-        // delete documents containing term: bbb
-        try {
-            reader1.delete(searchTerm2);
-            fail("Delete allowed from a stale index reader");
-        } catch (IOException e) {
-            /* success */
-        }
-
-        // RECREATE READER AND TRY AGAIN
-        reader1.close();
-        reader1 = IndexReader.open(dir);
-        assertEquals("reopened", 100, reader1.docFreq(searchTerm1));
-        assertEquals("reopened", 100, reader1.docFreq(searchTerm2));
-        assertEquals("reopened", 100, reader1.docFreq(searchTerm3));
-        assertTermDocsCount("reopened", reader1, searchTerm1, 0);
-        assertTermDocsCount("reopened", reader1, searchTerm2, 100);
-        assertTermDocsCount("reopened", reader1, searchTerm3, 100);
-
-        reader1.delete(searchTerm2);
-        assertEquals("deleted 2", 100, reader1.docFreq(searchTerm1));
-        assertEquals("deleted 2", 100, reader1.docFreq(searchTerm2));
-        assertEquals("deleted 2", 100, reader1.docFreq(searchTerm3));
-        assertTermDocsCount("deleted 2", reader1, searchTerm1, 0);
-        assertTermDocsCount("deleted 2", reader1, searchTerm2, 0);
-        assertTermDocsCount("deleted 2", reader1, searchTerm3, 100);
-        reader1.close();
-
-        // Open another reader to confirm that everything is deleted
-        reader2 = IndexReader.open(dir);
-        assertEquals("reopened 2", 100, reader2.docFreq(searchTerm1));
-        assertEquals("reopened 2", 100, reader2.docFreq(searchTerm2));
-        assertEquals("reopened 2", 100, reader2.docFreq(searchTerm3));
-        assertTermDocsCount("reopened 2", reader2, searchTerm1, 0);
-        assertTermDocsCount("reopened 2", reader2, searchTerm2, 0);
-        assertTermDocsCount("reopened 2", reader2, searchTerm3, 100);
-        reader2.close();
-
-        dir.close();
-    }
-
-
-    private void addDocumentWithFields(IndexWriter writer) throws IOException
-    {
-        Document doc = new Document();
-        doc.add(Field.Keyword("keyword","test1"));
-        doc.add(Field.Text("text","test1"));
-        doc.add(Field.UnIndexed("unindexed","test1"));
-        doc.add(Field.UnStored("unstored","test1"));
-        writer.addDocument(doc);
-    }
-
-    private void addDocumentWithDifferentFields(IndexWriter writer) throws IOException
-    {
-        Document doc = new Document();
-        doc.add(Field.Keyword("keyword2","test1"));
-        doc.add(Field.Text("text2","test1"));
-        doc.add(Field.UnIndexed("unindexed2","test1"));
-        doc.add(Field.UnStored("unstored2","test1"));
-        writer.addDocument(doc);
-    }
-
-    private void addDoc(IndexWriter writer, String value)
-    {
-        Document doc = new Document();
-        doc.add(Field.UnStored("content", value));
-
-        try
-        {
-            writer.addDocument(doc);
-        }
-        catch (IOException e)
-        {
-            e.printStackTrace();
-        }
-    }
-}

Modified: lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestInputStream.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestInputStream.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestInputStream.java (original)
+++ lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestInputStream.java Tue Mar 21 07:36:32 2006
@@ -1,37 +0,0 @@
-package org.apache.lucene.index;
-
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import junit.framework.TestCase;
-import org.apache.lucene.store.InputStream;
-
-import java.io.IOException;
-
-public class TestInputStream extends TestCase {
-    public void testRead() throws IOException {
-        InputStream is = new MockInputStream(new byte[] { (byte) 0x80, 0x01,
-                                                          (byte) 0xFF, 0x7F,
-                                                          (byte) 0x80, (byte) 0x80, 0x01,
-                                                          (byte) 0x81, (byte) 0x80, 0x01,
-                                                          0x06, 'L', 'u', 'c', 'e', 'n', 'e'});
-        assertEquals(128,is.readVInt());
-        assertEquals(16383,is.readVInt());
-        assertEquals(16384,is.readVInt());
-        assertEquals(16385,is.readVInt());
-        assertEquals("Lucene",is.readString());
-    }
-}

Modified: lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestSegmentTermEnum.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestSegmentTermEnum.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestSegmentTermEnum.java (original)
+++ lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestSegmentTermEnum.java Tue Mar 21 07:36:32 2006
@@ -1,110 +0,0 @@
-package org.apache.lucene.index;
-
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermEnum;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.RAMDirectory;
-
-/**
- * @author goller
- */
-public class TestSegmentTermEnum extends TestCase
-{
-  Directory dir = new RAMDirectory();
-
-  public void testTermEnum()
-  {
-    IndexWriter writer = null;
-
-    try {
-      writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
-
-      // add 100 documents with term : aaa
-      // add 100 documents with terms: aaa bbb
-      // Therefore, term 'aaa' has document frequency of 200 and term 'bbb' 100
-      for (int i = 0; i < 100; i++) {
-        addDoc(writer, "aaa");
-        addDoc(writer, "aaa bbb");
-      }
-
-      writer.close();
-    }
-    catch (IOException e) {
-      e.printStackTrace();
-    }
-
-    try {
-      // verify document frequency of terms in an unoptimized index
-      verifyDocFreq();
-
-      // merge segments by optimizing the index
-      writer = new IndexWriter(dir, new WhitespaceAnalyzer(), false);
-      writer.optimize();
-      writer.close();
-
-      // verify document frequency of terms in an optimized index
-      verifyDocFreq();
-    }
-    catch (IOException e2) {
-      e2.printStackTrace();
-    }
-  }
-
-  private void verifyDocFreq()
-      throws IOException
-  {
-      IndexReader reader = IndexReader.open(dir);
-      TermEnum termEnum = null;
-
-    // create enumeration of all terms
-    termEnum = reader.terms();
-    // go to the first term (aaa)
-    termEnum.next();
-    // assert that term is 'aaa'
-    assertEquals("aaa", termEnum.term().text());
-    assertEquals(200, termEnum.docFreq());
-    // go to the second term (bbb)
-    termEnum.next();
-    // assert that term is 'bbb'
-    assertEquals("bbb", termEnum.term().text());
-    assertEquals(100, termEnum.docFreq());
-
-    termEnum.close();
-
-
-    // create enumeration of terms after term 'aaa', including 'aaa'
-    termEnum = reader.terms(new Term("content", "aaa"));
-    // assert that term is 'aaa'
-    assertEquals("aaa", termEnum.term().text());
-    assertEquals(200, termEnum.docFreq());
-    // go to term 'bbb'
-    termEnum.next();
-    // assert that term is 'bbb'
-    assertEquals("bbb", termEnum.term().text());
-    assertEquals(100, termEnum.docFreq());
-
-    termEnum.close();
-  }
-
-  private void addDoc(IndexWriter writer, String value)
-  {
-    Document doc = new Document();
-    doc.add(Field.UnStored("content", value));
-
-    try {
-      writer.addDocument(doc);
-    }
-    catch (IOException e) {
-      e.printStackTrace();
-    }
-  }
-}

Modified: lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestTermVectorsReader.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestTermVectorsReader.java?rev=387550&r1=387549&r2=387550&view=diff
==============================================================================
--- lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestTermVectorsReader.java (original)
+++ lucene/java/trunk/src/test-deprecated/org/apache/lucene/index/TestTermVectorsReader.java Tue Mar 21 07:36:32 2006
@@ -1,106 +0,0 @@
-package org.apache.lucene.index;
-
-
-import junit.framework.TestCase;
-import org.apache.lucene.store.RAMDirectory;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-public class TestTermVectorsReader extends TestCase {
-  private TermVectorsWriter writer = null;
-  //Must be lexicographically sorted, will do in setup, versus trying to maintain here
-  private String [] testFields = {"f1", "f2", "f3"};
-  private String [] testTerms = {"this", "is", "a", "test"};
-  private RAMDirectory dir = new RAMDirectory();
-  private String seg = "testSegment";
-  private FieldInfos fieldInfos = new FieldInfos();
-
-  public TestTermVectorsReader(String s) {
-    super(s);
-  }
-
-  protected void setUp() {
-    for (int i = 0; i < testFields.length; i++) {
-      fieldInfos.add(testFields[i], true, true);
-    }
-    
-    try {
-      Arrays.sort(testTerms);
-      for (int j = 0; j < 5; j++) {
-        writer = new TermVectorsWriter(dir, seg, fieldInfos);
-        writer.openDocument();
-
-        for (int k = 0; k < testFields.length; k++) {
-          writer.openField(testFields[k]);
-          for (int i = 0; i < testTerms.length; i++) {
-            writer.addTerm(testTerms[i], i);      
-          }
-          writer.closeField();
-        }
-        writer.closeDocument();
-        writer.close();
-      }
-
-    } catch (IOException e) {
-      e.printStackTrace();
-      assertTrue(false);
-    }    
-  }
-
-  protected void tearDown() {
-
-  }
-
-  public void test() {
-      //Check to see the files were created properly in setup
-      assertTrue(writer.isDocumentOpen() == false);          
-      assertTrue(dir.fileExists(seg + TermVectorsWriter.TVD_EXTENSION));
-      assertTrue(dir.fileExists(seg + TermVectorsWriter.TVX_EXTENSION));
-  }
-  
-  public void testReader() {
-    try {
-      TermVectorsReader reader = new TermVectorsReader(dir, seg, fieldInfos);
-      assertTrue(reader != null);
-      TermFreqVector vector = reader.get(0, testFields[0]);
-      assertTrue(vector != null);
-      String [] terms = vector.getTerms();
-      assertTrue(terms != null);
-      assertTrue(terms.length == testTerms.length);
-      for (int i = 0; i < terms.length; i++) {
-        String term = terms[i];
-        //System.out.println("Term: " + term);
-        assertTrue(term.equals(testTerms[i]));
-      }
-      
-    } catch (IOException e) {
-      e.printStackTrace();
-      assertTrue(false);
-    }
-  }  
-
-  /**
-   * Make sure exceptions and bad params are handled appropriately
-   */ 
-  public void testBadParams() {
-    try {
-      TermVectorsReader reader = new TermVectorsReader(dir, seg, fieldInfos);
-      assertTrue(reader != null);
-      //Bad document number, good field number
-      TermFreqVector vector = reader.get(50, testFields[0]);
-      assertTrue(false);      
-    } catch (IOException e) {
-      assertTrue(true);
-    }
-    try {
-      TermVectorsReader reader = new TermVectorsReader(dir, seg, fieldInfos);
-      assertTrue(reader != null);
-      //good document number, bad field number
-      TermFreqVector vector = reader.get(0, "f50");
-      assertTrue(vector == null);      
-    } catch (IOException e) {
-      assertTrue(false);
-    }
-  }    
-}