Index: lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/TokenSources.java =================================================================== --- lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/TokenSources.java (revision 1154109) +++ lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/TokenSources.java (working copy) @@ -60,7 +60,7 @@ * @param analyzer The analyzer to use for creating the TokenStream if the * vector doesn't exist * @return The {@link org.apache.lucene.analysis.TokenStream} for the - * {@link org.apache.lucene.document.Fieldable} on the + * {@link org.apache.lucene.index.IndexableField} on the * {@link org.apache.lucene.document.Document} * @throws IOException if there was an error loading */ Index: lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldTermStack.java =================================================================== --- lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldTermStack.java (revision 1154109) +++ lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldTermStack.java (working copy) @@ -21,6 +21,7 @@ import java.util.LinkedList; import java.util.Set; +import org.apache.lucene.document.FieldType; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.TermFreqVector; import org.apache.lucene.index.TermPositionVector; @@ -46,8 +47,12 @@ // Directory dir = new RAMDirectory(); // IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(Version.LUCENE_CURRENT, analyzer)); // Document doc = new Document(); - // doc.add( new Field( "f", "a a a b b c a b b c d e f", Store.YES, Index.ANALYZED, TermVector.WITH_POSITIONS_OFFSETS ) ); - // doc.add( new Field( "f", "b a b a f", Store.YES, Index.ANALYZED, TermVector.WITH_POSITIONS_OFFSETS ) ); + // FieldType ft = new FieldType(TextField.TYPE_STORED); + // ft.setStoreTermVectors(true); + // ft.setStoreTermVectorOffsets(true); + // ft.setStoreTermVectorPositions(true); + // doc.add( new Field( "f", ft, "a a a b b c a b b c d e f" ) ); + // doc.add( new Field( "f", ft, "b a b a f" ) ); // writer.addDocument( doc ); // writer.close(); @@ -67,7 +72,7 @@ */ public FieldTermStack( IndexReader reader, int docId, String fieldName, final FieldQuery fieldQuery ) throws IOException { this.fieldName = fieldName; - + TermFreqVector tfv = reader.getTermFreqVector( docId, fieldName ); if( tfv == null ) return; // just return to make null snippets TermPositionVector tpv = null; Index: lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/package.html =================================================================== --- lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/package.html (revision 1154109) +++ lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/package.html (working copy) @@ -25,7 +25,7 @@
  • support N-gram fields
  • support phrase-unit highlighting with slops
  • need Java 1.5
  • -
  • highlight fields need to be TermVector.WITH_POSITIONS_OFFSETS
  • +
  • highlight fields need to be stored with term vector positions and offsets
  • take into account query boost to score fragments
  • support colored highlight tags
  • pluggable FragListBuilder
  • @@ -95,7 +95,7 @@

    Step 2.

    In Step 2, Fast Vector Highlighter generates {@link org.apache.lucene.search.vectorhighlight.FieldTermStack}. Fast Vector Highlighter uses {@link org.apache.lucene.index.TermFreqVector} data -(must be stored {@link org.apache.lucene.document.Field.TermVector#WITH_POSITIONS_OFFSETS}) +(must be stored with term vector positions and offsets) to generate it. FieldTermStack keeps the terms in the user query. Therefore, in this sample case, Fast Vector Highlighter generates the following FieldTermStack:

    Index: lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
    ===================================================================
    --- lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java	(revision 1154109)
    +++ lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java	(working copy)
    @@ -240,11 +240,8 @@
       /**
        * Convenience method; Tokenizes the given field text and adds the resulting
        * terms to the index; Equivalent to adding an indexed non-keyword Lucene
    -   * {@link org.apache.lucene.document.Field} that is
    -   * {@link org.apache.lucene.document.Field.Index#ANALYZED tokenized},
    -   * {@link org.apache.lucene.document.Field.Store#NO not stored},
    -   * {@link org.apache.lucene.document.Field.TermVector#WITH_POSITIONS termVectorStored with positions} (or
    -   * {@link org.apache.lucene.document.Field.TermVector#WITH_POSITIONS termVectorStored with positions and offsets}),
    +   * {@link org.apache.lucene.document.Field} that is tokenized, not stored,
    +   * termVectorStored with positions (or termVectorStored with positions and offsets),
        * 
        * @param fieldName
        *            a name to be associated with the text
    Index: lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorResult.java
    ===================================================================
    --- lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorResult.java	(revision 1153521)
    +++ lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorResult.java	(working copy)
    @@ -20,39 +20,41 @@
      *  Provides information about what should be done with this Field 
      *
      **/
    +import org.apache.lucene.index.IndexableField; // for javadocs
    +
     public enum FieldSelectorResult {
     
         /**
          * Load this {@link Field} every time the {@link Document} is loaded, reading in the data as it is encountered.
    -     *  {@link Document#getField(String)} and {@link Document#getFieldable(String)} should not return null.
    +     *  {@link Document#getField(String)} should not return null.
          *

    - * {@link Document#add(Fieldable)} should be called by the Reader. + * {@link Document#add(IndexableField)} should be called by the Reader. */ LOAD, /** * Lazily load this {@link Field}. This means the {@link Field} is valid, but it may not actually contain its data until - * invoked. {@link Document#getField(String)} SHOULD NOT BE USED. {@link Document#getFieldable(String)} is safe to use and should - * return a valid instance of a {@link Fieldable}. + * invoked. {@link Document#getField(String)} is safe to use and should + * return a valid instance of a {@link IndexableField}. *

    - * {@link Document#add(Fieldable)} should be called by the Reader. + * {@link Document#add(IndexableField)} should be called by the Reader. */ LAZY_LOAD, /** - * Do not load the {@link Field}. {@link Document#getField(String)} and {@link Document#getFieldable(String)} should return null. - * {@link Document#add(Fieldable)} is not called. + * Do not load the {@link Field}. {@link Document#getField(String)} should return null. + * {@link Document#add(IndexableField)} is not called. *

    - * {@link Document#add(Fieldable)} should not be called by the Reader. + * {@link Document#add(IndexableField)} should not be called by the Reader. */ NO_LOAD, /** * Load this field as in the {@link #LOAD} case, but immediately return from {@link Field} loading for the {@link Document}. Thus, the - * Document may not have its complete set of Fields. {@link Document#getField(String)} and {@link Document#getFieldable(String)} should + * Document may not have its complete set of Fields. {@link Document#getField(String)} should * both be valid for this {@link Field} *

    - * {@link Document#add(Fieldable)} should be called by the Reader. + * {@link Document#add(IndexableField)} should be called by the Reader. */ LOAD_AND_BREAK, @@ -67,10 +69,10 @@ /** * Lazily load this {@link Field}, but do not cache the result. This means the {@link Field} is valid, but it may not actually contain its data until - * invoked. {@link Document#getField(String)} SHOULD NOT BE USED. {@link Document#getFieldable(String)} is safe to use and should - * return a valid instance of a {@link Fieldable}. + * invoked. {@link Document#getField(String)} is safe to use and should + * return a valid instance of a {@link IndexableField}. *

    - * {@link Document#add(Fieldable)} should be called by the Reader. + * {@link Document#add(IndexableField)} should be called by the Reader. */ LATENT } Index: lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java =================================================================== --- lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java (revision 1154109) +++ lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java (working copy) @@ -36,7 +36,7 @@ * * If Similarity class is specified, uses its computeNorm method to set norms. * If -n command line argument is used, removed field norms, as if - * {@link org.apache.lucene.document.Field.Index}.NO_NORMS was used. + * {@link org.apache.lucene.document.FieldType#setOmitNorms(boolean)} was used. * *

    * NOTE: This will overwrite any length normalization or field/document boosts. Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java =================================================================== --- lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java (revision 1154109) +++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java (working copy) @@ -152,10 +152,10 @@ lazyFields.add("bin1"); FieldSelector sel = new SetBasedFieldSelector(new HashSet(), lazyFields); doc2 = getDocument(reader, reader.maxDoc() - 1, sel); - IndexableField[] fieldables = doc2.getFields("bin1"); - assertNotNull(fieldables); - assertEquals(1, fieldables.length); - IndexableField fb1 = fieldables[0]; + fields = doc2.getFields("bin1"); + assertNotNull(fields); + assertEquals(1, fields.length); + IndexableField fb1 = fields[0]; assertTrue(fb1.binaryValue(null)!=null); bytesRef = fb1.binaryValue(null); assertEquals(bin.length, bytesRef.bytes.length); Index: lucene/contrib/wordnet/src/java/org/apache/lucene/wordnet/Syns2Index.java =================================================================== --- lucene/contrib/wordnet/src/java/org/apache/lucene/wordnet/Syns2Index.java (revision 1154109) +++ lucene/contrib/wordnet/src/java/org/apache/lucene/wordnet/Syns2Index.java (working copy) @@ -56,7 +56,6 @@ * "word" field, and if present there will be fields named "syn" * for every synonym. What's tricky here is that there could be multiple * fields with the same name, in the general case for words that have multiple synonyms. - * That's not a problem with Lucene, you just use {@link org.apache.lucene.document.Document#getValues} *

    *

    * While the WordNet file distinguishes groups of synonyms with Index: lucene/src/java/org/apache/lucene/analysis/package.html =================================================================== --- lucene/src/java/org/apache/lucene/analysis/package.html (revision 1154109) +++ lucene/src/java/org/apache/lucene/analysis/package.html (working copy) @@ -172,7 +172,7 @@

    Field Section Boundaries

    - When {@link org.apache.lucene.document.Document#add(org.apache.lucene.document.Fieldable) document.add(field)} + When {@link org.apache.lucene.document.Document#add(org.apache.lucene.index.IndexableField) document.add(field)} is called multiple times for the same field name, we could say that each such call creates a new section for that field in that document. In fact, a separate call to Index: lucene/src/java/org/apache/lucene/document/BinaryField.java =================================================================== --- lucene/src/java/org/apache/lucene/document/BinaryField.java (revision 0) +++ lucene/src/java/org/apache/lucene/document/BinaryField.java (revision 0) @@ -0,0 +1,46 @@ +package org.apache.lucene.document; + +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 final class BinaryField extends Field { + + public static final FieldType TYPE_STORED = new FieldType(); + static { + TYPE_STORED.setStored(true); + TYPE_STORED.freeze(); + } + + public BinaryField(String name, byte[] value) { + super(name, BinaryField.TYPE_STORED, value); + this.isBinary = true; + } + + public BinaryField(String name, byte[] value, int offset, int length) { + super(name, BinaryField.TYPE_STORED, value, offset, length); + this.isBinary = true; + } + + public BinaryField(String name, FieldType custom, byte[] value) { + super(name, custom, value); + this.isBinary = true; + } + + public boolean isNumeric() { + return false; + } +} Index: lucene/src/java/org/apache/lucene/document/Field.java =================================================================== --- lucene/src/java/org/apache/lucene/document/Field.java (revision 1154109) +++ lucene/src/java/org/apache/lucene/document/Field.java (working copy) @@ -241,11 +241,7 @@ * into the score of all hits on this this field of this document. * *

    - * The boost is multiplied by - * {@link org.apache.lucene.document.Document#getBoost()} of the document - * containing this field. If a document has multiple fields with the same - * name, all such values are multiplied together. This product is then used to - * compute the norm factor for the field. By default, in the + * Boost is used to compute the norm factor for the field. By default, in the * {@link org.apache.lucene.search.Similarity#computeNorm(FieldInvertState)} * method, the boost value is multiplied by the length normalization factor * and then rounded by @@ -253,7 +249,6 @@ * it is stored in the index. One should attempt to ensure that this product * does not overflow the range of that encoding. * - * @see org.apache.lucene.document.Document#setBoost(float) * @see org.apache.lucene.search.Similarity#computeNorm(FieldInvertState) * @see org.apache.lucene.search.Similarity#encodeNormValue(float) */ Index: lucene/src/java/org/apache/lucene/document/FieldType.java =================================================================== --- lucene/src/java/org/apache/lucene/document/FieldType.java (revision 0) +++ lucene/src/java/org/apache/lucene/document/FieldType.java (revision 0) @@ -0,0 +1,183 @@ +package org.apache.lucene.document; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 FieldType { + + private boolean indexed; + private boolean stored; + private boolean tokenized; + private boolean storeTermVectors; + private boolean storeTermVectorOffsets; + private boolean storeTermVectorPositions; + private boolean omitNorms; + private boolean omitTermFreqsAndPositions; + private boolean lazy; + private boolean frozen; + + public FieldType(FieldType ref) { + this.indexed = ref.indexed(); + this.stored = ref.stored(); + this.tokenized = ref.tokenized(); + this.storeTermVectors = ref.storeTermVectors(); + this.storeTermVectorOffsets = ref.storeTermVectorOffsets(); + this.storeTermVectorPositions = ref.storeTermVectorPositions(); + this.omitNorms = ref.omitNorms(); + this.omitTermFreqsAndPositions = ref.omitTermFreqAndPositions(); + this.lazy = ref.lazy(); + } + + public FieldType() { + } + + private void checkIfFrozen() { + if (frozen) { + throw new IllegalStateException(); + } + } + + public void freeze() { + this.frozen = true; + } + + public boolean indexed() { + return this.indexed; + } + + public void setIndexed(boolean value) { + checkIfFrozen(); + this.indexed = value; + } + + public boolean stored() { + return this.stored; + } + + public void setStored(boolean value) { + checkIfFrozen(); + this.stored = value; + } + + public boolean tokenized() { + return this.tokenized; + } + + public void setTokenized(boolean value) { + checkIfFrozen(); + this.tokenized = value; + } + + public boolean storeTermVectors() { + return this.storeTermVectors; + } + + public void setStoreTermVectors(boolean value) { + checkIfFrozen(); + this.storeTermVectors = value; + } + + public boolean storeTermVectorOffsets() { + return this.storeTermVectorOffsets; + } + + public void setStoreTermVectorOffsets(boolean value) { + checkIfFrozen(); + this.storeTermVectorOffsets = value; + } + + public boolean storeTermVectorPositions() { + return this.storeTermVectorPositions; + } + + public void setStoreTermVectorPositions(boolean value) { + checkIfFrozen(); + this.storeTermVectorPositions = value; + } + + public boolean omitNorms() { + return this.omitNorms; + } + + public void setOmitNorms(boolean value) { + checkIfFrozen(); + this.omitNorms = value; + } + + public boolean omitTermFreqAndPositions() { + return this.omitTermFreqsAndPositions; + } + + public void setOmitTermFreqAndPositions(boolean value) { + checkIfFrozen(); + this.omitTermFreqsAndPositions = value; + } + + public boolean lazy() { + return this.lazy; + } + + public void setLazy(boolean value) { + checkIfFrozen(); + this.lazy = value; + } + + /** Prints a Field for human consumption. */ + @Override + public final String toString() { + StringBuilder result = new StringBuilder(); + if (stored()) { + result.append("stored"); + } + if (indexed()) { + if (result.length() > 0) + result.append(","); + result.append("indexed"); + } + if (tokenized()) { + if (result.length() > 0) + result.append(","); + result.append("tokenized"); + } + if (storeTermVectors()) { + if (result.length() > 0) + result.append(","); + result.append("termVector"); + } + if (storeTermVectorOffsets()) { + if (result.length() > 0) + result.append(","); + result.append("termVectorOffsets"); + } + if (storeTermVectorPositions()) { + if (result.length() > 0) + result.append(","); + result.append("termVectorPosition"); + } + if (omitNorms()) { + result.append(",omitNorms"); + } + if (omitTermFreqAndPositions()) { + result.append(",omitTermFreqAndPositions"); + } + if (lazy()){ + result.append(",lazy"); + } + + return result.toString(); + } +} Index: lucene/src/java/org/apache/lucene/document/StringField.java =================================================================== --- lucene/src/java/org/apache/lucene/document/StringField.java (revision 0) +++ lucene/src/java/org/apache/lucene/document/StringField.java (revision 0) @@ -0,0 +1,53 @@ +package org.apache.lucene.document; + +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 final class StringField extends Field { + + public static final FieldType TYPE_UNSTORED = new FieldType(); + public static final FieldType TYPE_STORED = new FieldType(); + static { + TYPE_UNSTORED.setIndexed(true); + TYPE_UNSTORED.setOmitNorms(true); + TYPE_UNSTORED.setOmitTermFreqAndPositions(true); + TYPE_UNSTORED.freeze(); + + TYPE_STORED.setIndexed(true); + TYPE_STORED.setStored(true); + TYPE_STORED.setOmitNorms(true); + TYPE_STORED.setOmitTermFreqAndPositions(true); + TYPE_STORED.freeze(); + } + + public StringField(String name, boolean internName, String value) { + super(name, StringField.TYPE_UNSTORED, value); + } + + public StringField(String name, String value) { + this(name, true, value); + } + + @Override + public String stringValue() { + return (fieldsData == null) ? null : fieldsData.toString(); + } + + public boolean isNumeric() { + return false; + } +} Index: lucene/src/java/org/apache/lucene/document/TextField.java =================================================================== --- lucene/src/java/org/apache/lucene/document/TextField.java (revision 0) +++ lucene/src/java/org/apache/lucene/document/TextField.java (revision 0) @@ -0,0 +1,54 @@ +package org.apache.lucene.document; + +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.Reader; + +import org.apache.lucene.analysis.TokenStream; + +public final class TextField extends Field { + + public static final FieldType TYPE_UNSTORED = new FieldType(); + public static final FieldType TYPE_STORED = new FieldType(); + static { + TYPE_UNSTORED.setIndexed(true); + TYPE_UNSTORED.setTokenized(true); + TYPE_UNSTORED.freeze(); + + TYPE_STORED.setIndexed(true); + TYPE_STORED.setStored(true); + TYPE_STORED.setTokenized(true); + TYPE_STORED.freeze(); + } + + public TextField(String name, Reader reader) { + super(name, TextField.TYPE_UNSTORED, reader); + } + + public TextField(String name, String value) { + super(name, TextField.TYPE_UNSTORED, value); + } + + public TextField(String name, TokenStream stream) { + super(name, TextField.TYPE_UNSTORED, stream); + } + + public boolean isNumeric() { + return false; + } +} Index: lucene/src/java/org/apache/lucene/document/package.html =================================================================== --- lucene/src/java/org/apache/lucene/document/package.html (revision 1154109) +++ lucene/src/java/org/apache/lucene/document/package.html (working copy) @@ -0,0 +1,56 @@ + + + + + + + +

    The logical representation of a {@link org.apache.lucene.document.Document} for indexing and searching.

    +

    The document package provides the user level logical representation of content to be indexed and searched. The +package also provides utilities for working with {@link org.apache.lucene.document.Document}s and {@link org.apache.lucene.document.Fieldable}s.

    +

    Document and Fieldable

    +

    A {@link org.apache.lucene.document.Document} is a collection of {@link org.apache.lucene.document.Fieldable}s. A + {@link org.apache.lucene.document.Fieldable} is a logical representation of a user's content that needs to be indexed or stored. + {@link org.apache.lucene.document.Fieldable}s have a number of properties that tell Lucene how to treat the content (like indexed, tokenized, + stored, etc.) See the {@link org.apache.lucene.document.Field} implementation of {@link org.apache.lucene.document.Fieldable} + for specifics on these properties. +

    +

    Note: it is common to refer to {@link org.apache.lucene.document.Document}s having {@link org.apache.lucene.document.Field}s, even though technically they have +{@link org.apache.lucene.document.Fieldable}s.

    +

    Working with Documents

    +

    First and foremost, a {@link org.apache.lucene.document.Document} is something created by the user application. It is your job + to create Documents based on the content of the files you are working with in your application (Word, txt, PDF, Excel or any other format.) + How this is done is completely up to you. That being said, there are many tools available in other projects that can make + the process of taking a file and converting it into a Lucene {@link org.apache.lucene.document.Document}. To see an example of this, + take a look at the Lucene demo and the associated source code + for extracting content from HTML. +

    +

    The {@link org.apache.lucene.document.DateTools} is a utility class to make dates and times searchable +(remember, Lucene only searches text). {@link org.apache.lucene.document.NumericField} is a special helper class +to simplify indexing of numeric values (and also dates) for fast range range queries with {@link org.apache.lucene.search.NumericRangeQuery} +(using a special sortable string representation of numeric values).

    +

    The {@link org.apache.lucene.index.StoredFieldVisitor} class provides a mechanism to customize how the stored fields values are processed. +If no StoredFieldVisitor is used, all Fields are loaded into a returned Document. As an example of the StoredFieldVisitor usage, consider + the common use case of +displaying search results on a web page and then having users click through to see the full document. In this scenario, it is often + the case that there are many small fields and one or two large fields (containing the contents of the original file). Before StoredFieldVisitor, +the full Document had to be loaded, including the large fields, in order to display the results. Now, using the StoredFieldVisitor, one +can choose which fields should be loaded and how their values should be recorded. If you simply want to load only certain fields, consider using +{@link org.apache.lucene.index.DocumentStoredFieldVisitor}. + + Index: lucene/src/java/org/apache/lucene/index/CheckIndex.java =================================================================== --- lucene/src/java/org/apache/lucene/index/CheckIndex.java (revision 1154109) +++ lucene/src/java/org/apache/lucene/index/CheckIndex.java (working copy) @@ -17,6 +17,7 @@ * limitations under the License. */ +import org.apache.lucene.document.FieldType; // for javadocs import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.TermQuery; @@ -175,7 +176,7 @@ /** True if at least one of the fields in this segment * does not omitTermFreqAndPositions. - * @see AbstractField#setOmitTermFreqAndPositions */ + * @see FieldType#setOmitTermFreqAndPositions */ public boolean hasProx; /** Map that includes certain Index: lucene/src/java/org/apache/lucene/index/FieldInfos.java =================================================================== --- lucene/src/java/org/apache/lucene/index/FieldInfos.java (revision 1154109) +++ lucene/src/java/org/apache/lucene/index/FieldInfos.java (working copy) @@ -37,8 +37,8 @@ import org.apache.lucene.util.CodecUtil; import org.apache.lucene.util.StringHelper; -/** Access to the Fieldable Info file that describes document fields and whether or - * not they are indexed. Each segment has a separate Fieldable Info file. Objects +/** Access to the Field Info file that describes document fields and whether or + * not they are indexed. Each segment has a separate Field Info file. Objects * of this class are thread-safe for multiple readers, but only one thread can * be adding documents at a time, with no other reader or writer threads * accessing this object. @@ -359,7 +359,7 @@ /** * Calls 5 parameter add with false for all TermVector parameters. * - * @param name The name of the Fieldable + * @param name The name of the IndexableField * @param isIndexed true if the field is indexed * @see #addOrUpdate(String, boolean, boolean, boolean, boolean) */ Index: lucene/src/java/org/apache/lucene/index/IndexReader.java =================================================================== --- lucene/src/java/org/apache/lucene/index/IndexReader.java (revision 1154109) +++ lucene/src/java/org/apache/lucene/index/IndexReader.java (working copy) @@ -861,7 +861,6 @@ * @return array of term frequency vectors. May be null if no term vectors have been * stored for the specified document. * @throws IOException if index cannot be accessed - * @see org.apache.lucene.document.Field.TermVector */ abstract public TermFreqVector[] getTermFreqVectors(int docNumber) throws IOException; @@ -879,7 +878,6 @@ * @return term frequency vector May be null if field does not exist in the specified * document or term vector was not stored. * @throws IOException if index cannot be accessed - * @see org.apache.lucene.document.Field.TermVector */ abstract public TermFreqVector getTermFreqVector(int docNumber, String field) throws IOException; Index: lucene/src/java/org/apache/lucene/index/TermFreqVector.java =================================================================== --- lucene/src/java/org/apache/lucene/index/TermFreqVector.java (revision 1154109) +++ lucene/src/java/org/apache/lucene/index/TermFreqVector.java (working copy) @@ -26,7 +26,7 @@ */ public interface TermFreqVector { /** - * The {@link org.apache.lucene.document.Fieldable} name. + * The {@link org.apache.lucene.index.IndexableField} name. * @return The name of the field this vector is associated with. * */ Index: lucene/src/java/org/apache/lucene/search/Similarity.java =================================================================== --- lucene/src/java/org/apache/lucene/search/Similarity.java (revision 1154109) +++ lucene/src/java/org/apache/lucene/search/Similarity.java (working copy) @@ -453,12 +453,8 @@ * norm(t,d) encapsulates a few (indexing time) boost and length factors: * *