Index: lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java
===================================================================
--- lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java (revision 1153521)
+++ lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java (working copy)
@@ -19,11 +19,11 @@
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.NumericField;
-import org.apache.lucene.document2.StringField;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.NumericField;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.index.IndexWriterConfig;
Index: lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java
===================================================================
--- lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java (revision 1153521)
+++ lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java (working copy)
@@ -26,7 +26,7 @@
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.document2.Document;
+import org.apache.lucene.document.Document;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
@@ -175,7 +175,7 @@
continue;
}
- Document doc = searcher.doc2(hits[i].doc);
+ Document doc = searcher.doc(hits[i].doc);
String path = doc.get("path");
if (path != null) {
System.out.println((i+1) + ". " + path);
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 1153521)
+++ lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/TokenSources.java (working copy)
@@ -31,7 +31,7 @@
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
-import org.apache.lucene.document2.Document;
+import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.TermFreqVector;
import org.apache.lucene.index.TermPositionVector;
@@ -270,7 +270,7 @@
// convenience method
public static TokenStream getTokenStream(IndexReader reader, int docId,
String field, Analyzer analyzer) throws IOException {
- Document doc = reader.document2(docId);
+ Document doc = reader.document(docId);
return getTokenStream(doc, field, analyzer);
}
Index: lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java
===================================================================
--- lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java (revision 1153521)
+++ lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java (working copy)
@@ -21,9 +21,9 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.StoredFieldVisitor;
Index: lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java
===================================================================
--- lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java (revision 1153521)
+++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java (working copy)
@@ -26,10 +26,10 @@
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
Index: lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
===================================================================
--- lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java (revision 1153521)
+++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java (working copy)
@@ -42,11 +42,11 @@
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.NumericField;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.NumericField;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
@@ -112,7 +112,7 @@
for (int i = 0; i < hits.scoreDocs.length; i++) {
- Document doc = searcher.doc2(hits.scoreDocs[i].doc);
+ Document doc = searcher.doc(hits.scoreDocs[i].doc);
String storedField = doc.get(FIELD_NAME);
TokenStream stream = TokenSources.getAnyTokenStream(searcher
@@ -185,7 +185,7 @@
Highlighter highlighter = new Highlighter(scorer);
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME,
new StringReader(text));
highlighter.setTextFragmenter(new SimpleFragmenter(40));
@@ -234,7 +234,7 @@
Highlighter highlighter = new Highlighter(this, scorer);
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
highlighter.setTextFragmenter(new SimpleFragmenter(40));
@@ -256,7 +256,7 @@
highlighter = new Highlighter(this, scorer);
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
highlighter.setTextFragmenter(new SimpleFragmenter(40));
@@ -278,7 +278,7 @@
highlighter = new Highlighter(this, scorer);
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
highlighter.setTextFragmenter(new SimpleFragmenter(40));
@@ -303,7 +303,7 @@
Highlighter highlighter = new Highlighter(this, scorer);
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
highlighter.setTextFragmenter(new SimpleFragmenter(40));
@@ -327,7 +327,7 @@
Highlighter highlighter = new Highlighter(this, scorer);
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
highlighter.setTextFragmenter(new SimpleFragmenter(40));
@@ -352,7 +352,7 @@
Highlighter highlighter = new Highlighter(this, scorer);
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(NUMERIC_FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(NUMERIC_FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
highlighter.setTextFragmenter(new SimpleFragmenter(40));
@@ -375,7 +375,7 @@
highlighter.setTextFragmenter(new SimpleFragmenter(40));
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
String result = highlighter.getBestFragments(tokenStream, text, maxNumFragmentsRequired,
@@ -393,7 +393,7 @@
int maxNumFragmentsRequired = 2;
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
QueryScorer scorer = new QueryScorer(query, FIELD_NAME);
Highlighter highlighter = new Highlighter(this, scorer);
@@ -418,7 +418,7 @@
Highlighter highlighter = new Highlighter(this, scorer);
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
highlighter.setTextFragmenter(new SimpleSpanFragmenter(scorer, 5));
@@ -437,7 +437,7 @@
highlighter = new Highlighter(this, scorer);
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
highlighter.setTextFragmenter(new SimpleSpanFragmenter(scorer, 20));
@@ -459,7 +459,7 @@
Highlighter highlighter = new Highlighter(this,scorer);
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME,new StringReader(text));
highlighter.setTextFragmenter(new SimpleFragmenter(40));
@@ -530,7 +530,7 @@
highlighter.setTextFragmenter(new SimpleFragmenter(40));
int maxNumFragmentsRequired = 2;
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
String result = highlighter.getBestFragments(tokenStream, text, maxNumFragmentsRequired,
@@ -688,7 +688,7 @@
hits = searcher.search(query, null, 1000);
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(HighlighterTest.FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(HighlighterTest.FIELD_NAME);
int maxNumFragmentsRequired = 2;
String fragmentSeparator = "...";
QueryScorer scorer;
@@ -716,7 +716,7 @@
numHighlights = 0;
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(HighlighterTest.FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(HighlighterTest.FIELD_NAME);
int maxNumFragmentsRequired = 2;
String fragmentSeparator = "...";
QueryScorer scorer;
@@ -744,7 +744,7 @@
numHighlights = 0;
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(HighlighterTest.FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(HighlighterTest.FIELD_NAME);
int maxNumFragmentsRequired = 2;
String fragmentSeparator = "...";
QueryScorer scorer;
@@ -908,7 +908,7 @@
doSearching("Kennedy");
numHighlights = 0;
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
Highlighter highlighter = getHighlighter(query, FIELD_NAME, tokenStream,
@@ -922,7 +922,7 @@
numHighlights = 0;
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
Highlighter highlighter = getHighlighter(query, FIELD_NAME, tokenStream,
HighlighterTest.this);
@@ -933,7 +933,7 @@
numHighlights = 0;
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
Highlighter highlighter = getHighlighter(query, FIELD_NAME, tokenStream,
@@ -1041,7 +1041,7 @@
// new Highlighter(HighlighterTest.this, new QueryTermScorer(query));
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
Highlighter highlighter = getHighlighter(query, FIELD_NAME, tokenStream,
HighlighterTest.this);
@@ -1064,7 +1064,7 @@
doSearching("Kennedy");
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
Highlighter highlighter = getHighlighter(query, FIELD_NAME, tokenStream,
@@ -1216,7 +1216,7 @@
int maxNumFragmentsRequired = 3;
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
Highlighter highlighter = getHighlighter(query, FIELD_NAME, tokenStream, HighlighterTest.this, false);
@@ -1568,7 +1568,7 @@
TopDocs hits = searcher.search(query, null, 10);
for( int i = 0; i < hits.totalHits; i++ ){
- Document doc = searcher.doc2( hits.scoreDocs[i].doc );
+ Document doc = searcher.doc( hits.scoreDocs[i].doc );
String result = h.getBestFragment( a, "t_text1", doc.get( "t_text1" ));
if (VERBOSE) System.out.println("result:" + result);
assertEquals("more random words for second field", result);
@@ -1631,7 +1631,7 @@
public void assertExpectedHighlightCount(final int maxNumFragmentsRequired,
final int expectedHighlights) throws Exception {
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
QueryScorer scorer = new QueryScorer(query, FIELD_NAME);
Highlighter highlighter = new Highlighter(this, scorer);
@@ -1864,7 +1864,7 @@
throws Exception {
for (int i = 0; i < hits.totalHits; i++) {
- String text = searcher.doc2(hits.scoreDocs[i].doc).get(HighlighterTest.FIELD_NAME);
+ String text = searcher.doc(hits.scoreDocs[i].doc).get(HighlighterTest.FIELD_NAME);
int maxNumFragmentsRequired = 2;
String fragmentSeparator = "...";
Scorer scorer = null;
Index: lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java
===================================================================
--- lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java (revision 1153521)
+++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java (working copy)
@@ -26,10 +26,10 @@
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
Index: lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java
===================================================================
--- lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java (revision 1153521)
+++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java (working copy)
@@ -28,10 +28,10 @@
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
Index: lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java
===================================================================
--- lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java (revision 1153521)
+++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java (working copy)
@@ -17,10 +17,10 @@
* limitations under the License.
*/
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
Index: lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java
===================================================================
--- lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java (revision 1153521)
+++ lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java (working copy)
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import org.apache.lucene.document2.Document;
+import org.apache.lucene.document.Document;
import java.util.List;
import java.util.Map;
Index: lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java
===================================================================
--- lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java (revision 1153521)
+++ lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java (working copy)
@@ -26,7 +26,7 @@
import java.util.Set;
import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.document2.Document;
+import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.MultiNorms;
@@ -189,7 +189,7 @@
} else {
InstantiatedDocument document = new InstantiatedDocument();
// copy stored fields from source reader
- Document sourceDocument = sourceIndexReader.document2(i);
+ Document sourceDocument = sourceIndexReader.document(i);
for (IndexableField field : sourceDocument) {
if (fields == null || fields.contains(field.name())) {
document.getDocument().add(field);
Index: lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexReader.java
===================================================================
--- lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexReader.java (revision 1153521)
+++ lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexReader.java (working copy)
@@ -29,7 +29,7 @@
import java.util.Set;
import java.util.Comparator;
-import org.apache.lucene.document2.Document;
+import org.apache.lucene.document.Document;
import org.apache.lucene.index.*;
import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.store.Directory;
@@ -272,7 +272,7 @@
*/
@Override
- public Document document2(int n) throws IOException {
+ public Document document(int n) throws IOException {
return getIndex().getDocumentsByNumber()[n].getDocument();
}
Index: lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
===================================================================
--- lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java (revision 1153521)
+++ lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java (working copy)
@@ -36,7 +36,7 @@
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.document2.Document;
+import org.apache.lucene.document.Document;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexableField;
Index: lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
===================================================================
--- lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java (revision 1153521)
+++ lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java (working copy)
@@ -27,10 +27,10 @@
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.MultiNorms;
Index: lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java
===================================================================
--- lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java (revision 1153521)
+++ lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java (working copy)
@@ -18,9 +18,9 @@
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.Scorer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.StringField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.index.Term;
import org.apache.lucene.util.LuceneTestCase;
Index: lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestUnoptimizedReaderOnConstructor.java
===================================================================
--- lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestUnoptimizedReaderOnConstructor.java (revision 1153521)
+++ lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestUnoptimizedReaderOnConstructor.java (working copy)
@@ -24,8 +24,8 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.TextField;
/**
* @since 2009-mar-30 13:15:49
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 1153521)
+++ lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (working copy)
@@ -34,7 +34,7 @@
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute;
-import org.apache.lucene.document2.Document;
+import org.apache.lucene.document.Document;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.FieldInvertState;
Index: lucene/contrib/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java
===================================================================
--- lucene/contrib/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java (revision 1153521)
+++ lucene/contrib/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java (working copy)
@@ -29,9 +29,9 @@
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenFilter;
import org.apache.lucene.analysis.MockTokenizer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.queryParser.QueryParser;
Index: lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelector.java
===================================================================
--- lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelector.java (revision 1153521)
+++ lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelector.java (working copy)
@@ -1,5 +1,8 @@
-package org.apache.lucene.document2;
+package org.apache.lucene.document;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+
/**
* Copyright 2004 The Apache Software Foundation
*
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)
@@ -1,4 +1,4 @@
-package org.apache.lucene.document2;
+package org.apache.lucene.document;
/**
* Copyright 2004 The Apache Software Foundation
Index: lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java
===================================================================
--- lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java (revision 1153521)
+++ lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java (working copy)
@@ -1,4 +1,4 @@
-package org.apache.lucene.document2;
+package org.apache.lucene.document;
/**
* Copyright 2004 The Apache Software Foundation
@@ -20,7 +20,13 @@
import java.io.Reader;
import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.document2.NumericField.DataType;
+import org.apache.lucene.document.BinaryField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.NumericField;
+import org.apache.lucene.document.TextField;
+import org.apache.lucene.document.NumericField.DataType;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.FieldReaderException;
import org.apache.lucene.index.IndexReader;
Index: lucene/contrib/misc/src/java/org/apache/lucene/document/LoadFirstFieldSelector.java
===================================================================
--- lucene/contrib/misc/src/java/org/apache/lucene/document/LoadFirstFieldSelector.java (revision 1153521)
+++ lucene/contrib/misc/src/java/org/apache/lucene/document/LoadFirstFieldSelector.java (working copy)
@@ -1,4 +1,4 @@
-package org.apache.lucene.document2;
+package org.apache.lucene.document;
/**
* Copyright 2004 The Apache Software Foundation
*
Index: lucene/contrib/misc/src/java/org/apache/lucene/document/MapFieldSelector.java
===================================================================
--- lucene/contrib/misc/src/java/org/apache/lucene/document/MapFieldSelector.java (revision 1153521)
+++ lucene/contrib/misc/src/java/org/apache/lucene/document/MapFieldSelector.java (working copy)
@@ -1,4 +1,4 @@
-package org.apache.lucene.document2;
+package org.apache.lucene.document;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
Index: lucene/contrib/misc/src/java/org/apache/lucene/document/SetBasedFieldSelector.java
===================================================================
--- lucene/contrib/misc/src/java/org/apache/lucene/document/SetBasedFieldSelector.java (revision 1153521)
+++ lucene/contrib/misc/src/java/org/apache/lucene/document/SetBasedFieldSelector.java (working copy)
@@ -1,4 +1,4 @@
-package org.apache.lucene.document2;
+package org.apache.lucene.document;
/**
* Copyright 2004 The Apache Software Foundation
@@ -18,6 +18,8 @@
import java.util.Set;
+import org.apache.lucene.document.Field;
+
/**
* Declare what fields to load normally and what fields to load lazily
*
Index: lucene/contrib/misc/src/java/org/apache/lucene/document2/FieldSelector.java
===================================================================
--- lucene/contrib/misc/src/java/org/apache/lucene/document2/FieldSelector.java (revision 1153521)
+++ lucene/contrib/misc/src/java/org/apache/lucene/document2/FieldSelector.java (working copy)
@@ -1,33 +0,0 @@
-package org.apache.lucene.document2;
-
-/**
- * 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.
- */
-
-/**
- * Similar to a {@link java.io.FileFilter}, the FieldSelector allows one to make decisions about
- * what Fields get loaded on a {@link Document} by {@link FieldSelectorVisitor}
- *
- **/
-public interface FieldSelector {
-
- /**
- *
- * @param fieldName the field to accept or reject
- * @return an instance of {@link FieldSelectorResult}
- * if the {@link Field} named fieldName should be loaded.
- */
- FieldSelectorResult accept(String fieldName);
-}
Index: lucene/contrib/misc/src/java/org/apache/lucene/document2/FieldSelectorResult.java
===================================================================
--- lucene/contrib/misc/src/java/org/apache/lucene/document2/FieldSelectorResult.java (revision 1153521)
+++ lucene/contrib/misc/src/java/org/apache/lucene/document2/FieldSelectorResult.java (working copy)
@@ -1,76 +0,0 @@
-package org.apache.lucene.document2;
-
-/**
- * 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.
- */
-
-/**
- * Provides information about what should be done with this Field
- *
- **/
-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.
- *
NOTE: If you use Lazy fields, you should not - * access the returned document after the reader has been - * closed! - */ - -public class FieldSelectorVisitor extends StoredFieldVisitor { - - private final FieldSelector selector; - private final Document doc; - - public FieldSelectorVisitor(FieldSelector selector) { - this.selector = selector; - doc = new Document(); - } - - public Document getDocument() { - return doc; - } - - @Override - public boolean binaryField(FieldInfo fieldInfo, IndexInput in, int numBytes) throws IOException { - final FieldSelectorResult accept = selector.accept(fieldInfo.name); - switch (accept) { - case LOAD: - case LOAD_AND_BREAK: - final byte[] b = new byte[numBytes]; - in.readBytes(b, 0, b.length); - doc.add(new BinaryField(fieldInfo.name, b)); - return accept != FieldSelectorResult.LOAD; - case LAZY_LOAD: - case LATENT: - addFieldLazy(in, fieldInfo, true, accept == FieldSelectorResult.LAZY_LOAD, numBytes); - return false; - case SIZE: - case SIZE_AND_BREAK: - in.seek(in.getFilePointer() + numBytes); - addFieldSize(fieldInfo, numBytes); - return accept != FieldSelectorResult.SIZE; - default: - // skip - in.seek(in.getFilePointer() + numBytes); - return false; - } - } - - @Override - public boolean stringField(FieldInfo fieldInfo, IndexInput in, int numUTF8Bytes) throws IOException { - final FieldSelectorResult accept = selector.accept(fieldInfo.name); - switch (accept) { - case LOAD: - case LOAD_AND_BREAK: - final byte[] b = new byte[numUTF8Bytes]; - in.readBytes(b, 0, b.length); - FieldType ft = new FieldType(TextField.TYPE_STORED); - ft.setStoreTermVectors(fieldInfo.storeTermVector); - ft.setStoreTermVectorOffsets(fieldInfo.storeOffsetWithTermVector); - ft.setStoreTermVectorPositions(fieldInfo.storePositionWithTermVector); - doc.add(new Field(fieldInfo.name, ft, new String(b, "UTF-8"))); - return accept != FieldSelectorResult.LOAD; - case LAZY_LOAD: - case LATENT: - addFieldLazy(in, fieldInfo, false, accept == FieldSelectorResult.LAZY_LOAD, numUTF8Bytes); - return false; - case SIZE: - case SIZE_AND_BREAK: - in.seek(in.getFilePointer() + numUTF8Bytes); - addFieldSize(fieldInfo, 2*numUTF8Bytes); - return accept != FieldSelectorResult.SIZE; - default: - // skip - in.seek(in.getFilePointer() + numUTF8Bytes); - return false; - } - } - - @Override - public boolean intField(FieldInfo fieldInfo, int value) throws IOException { - FieldType ft = new FieldType(NumericField.TYPE_STORED); - ft.setIndexed(fieldInfo.isIndexed); - ft.setOmitNorms(fieldInfo.omitNorms); - ft.setOmitTermFreqAndPositions(fieldInfo.omitTermFreqAndPositions); - return addNumericField(fieldInfo, new NumericField(fieldInfo.name, ft).setIntValue(value)); - } - - @Override - public boolean longField(FieldInfo fieldInfo, long value) throws IOException { - FieldType ft = new FieldType(NumericField.TYPE_STORED); - ft.setIndexed(fieldInfo.isIndexed); - ft.setOmitNorms(fieldInfo.omitNorms); - ft.setOmitTermFreqAndPositions(fieldInfo.omitTermFreqAndPositions); - return addNumericField(fieldInfo, new NumericField(fieldInfo.name, ft).setLongValue(value)); - } - - @Override - public boolean floatField(FieldInfo fieldInfo, float value) throws IOException { - FieldType ft = new FieldType(NumericField.TYPE_STORED); - ft.setIndexed(fieldInfo.isIndexed); - ft.setOmitNorms(fieldInfo.omitNorms); - ft.setOmitTermFreqAndPositions(fieldInfo.omitTermFreqAndPositions); - return addNumericField(fieldInfo, new NumericField(fieldInfo.name, ft).setFloatValue(value)); - } - - @Override - public boolean doubleField(FieldInfo fieldInfo, double value) throws IOException { - FieldType ft = new FieldType(NumericField.TYPE_STORED); - ft.setIndexed(fieldInfo.isIndexed); - ft.setOmitNorms(fieldInfo.omitNorms); - ft.setOmitTermFreqAndPositions(fieldInfo.omitTermFreqAndPositions); - return addNumericField(fieldInfo, new NumericField(fieldInfo.name, ft).setDoubleValue(value)); - } - - private boolean addNumericField(FieldInfo fieldInfo, NumericField f) { - doc.add(f); - final FieldSelectorResult accept = selector.accept(fieldInfo.name); - switch (accept) { - case LOAD: - return false; - case LOAD_AND_BREAK: - return true; - case LAZY_LOAD: - case LATENT: - return false; - case SIZE: - return false; - case SIZE_AND_BREAK: - return true; - default: - return false; - } - } - - private void addFieldLazy(IndexInput in, FieldInfo fi, boolean binary, boolean cacheResult, int numBytes) throws IOException { - final IndexableField f; - final long pointer = in.getFilePointer(); - // Need to move the pointer ahead by toRead positions - in.seek(pointer+numBytes); - FieldType ft = new FieldType(); - ft.setStored(true); - ft.setOmitNorms(fi.omitNorms); - ft.setOmitTermFreqAndPositions(fi.omitTermFreqAndPositions); - ft.setLazy(true); - - if (binary) { - f = new LazyField(in, fi.name, ft, numBytes, pointer, binary, cacheResult); - } else { - ft.setStoreTermVectors(fi.storeTermVector); - ft.setStoreTermVectorOffsets(fi.storeOffsetWithTermVector); - ft.setStoreTermVectorPositions(fi.storePositionWithTermVector); - f = new LazyField(in, fi.name, ft, numBytes, pointer, binary, cacheResult); - } - - doc.add(f); - } - - // Add the size of field as a byte[] containing the 4 bytes of the integer byte size (high order byte first; char = 2 bytes) - // Read just the size -- caller must skip the field content to continue reading fields - // Return the size in bytes or chars, depending on field type - private void addFieldSize(FieldInfo fi, int numBytes) throws IOException { - byte[] sizebytes = new byte[4]; - sizebytes[0] = (byte) (numBytes>>>24); - sizebytes[1] = (byte) (numBytes>>>16); - sizebytes[2] = (byte) (numBytes>>> 8); - sizebytes[3] = (byte) numBytes ; - doc.add(new BinaryField(fi.name, sizebytes)); - } - - /** - * A Lazy field implementation that defers loading of fields until asked for, instead of when the Document is - * loaded. - */ - private static class LazyField extends Field { - private int toRead; - private long pointer; - private final boolean cacheResult; - private final IndexInput in; - - public LazyField(IndexInput in, String name, FieldType ft, int toRead, long pointer, boolean isBinary, boolean cacheResult) { - super(name, ft); - this.in = in; - this.toRead = toRead; - this.pointer = pointer; - this.isBinary = isBinary; - this.cacheResult = cacheResult; - if (isBinary) - binaryLength = toRead; - } - - @Override - public Number numericValue() { - return null; - } - - @Override - public DataType numericDataType() { - return null; - } - - private IndexInput localFieldsStream; - - private IndexInput getFieldStream() { - if (localFieldsStream == null) { - localFieldsStream = (IndexInput) in.clone(); - } - return localFieldsStream; - } - - /** The value of the field as a Reader, or null. If null, the String value, - * binary value, or TokenStream value is used. Exactly one of stringValue(), - * readerValue(), getBinaryValue(), and tokenStreamValue() must be set. */ - public Reader readerValue() { - return null; - } - - /** The value of the field as a TokenStream, or null. If null, the Reader value, - * String value, or binary value is used. Exactly one of stringValue(), - * readerValue(), getBinaryValue(), and tokenStreamValue() must be set. */ - public TokenStream tokenStreamValue() { - return null; - } - - /** The value of the field as a String, or null. If null, the Reader value, - * binary value, or TokenStream value is used. Exactly one of stringValue(), - * readerValue(), getBinaryValue(), and tokenStreamValue() must be set. */ - synchronized public String stringValue() { - if (isBinary) - return null; - else { - if (fieldsData == null) { - String result = null; - IndexInput localFieldsStream = getFieldStream(); - try { - localFieldsStream.seek(pointer); - byte[] bytes = new byte[toRead]; - localFieldsStream.readBytes(bytes, 0, toRead); - result = new String(bytes, "UTF-8"); - } catch (IOException e) { - throw new FieldReaderException(e); - } - if (cacheResult == true){ - fieldsData = result; - } - return result; - } else { - return (String) fieldsData; - } - } - } - - synchronized private byte[] getBinaryValue(byte[] result) { - if (isBinary) { - if (fieldsData == null) { - // Allocate new buffer if result is null or too small - final byte[] b; - if (result == null || result.length < toRead) - b = new byte[toRead]; - else - b = result; - - IndexInput localFieldsStream = getFieldStream(); - - // Throw this IOException since IndexReader.document does so anyway, so probably not that big of a change for people - // since they are already handling this exception when getting the document - try { - localFieldsStream.seek(pointer); - localFieldsStream.readBytes(b, 0, toRead); - } catch (IOException e) { - throw new FieldReaderException(e); - } - - binaryOffset = 0; - binaryLength = toRead; - if (cacheResult == true){ - fieldsData = b; - } - return b; - } else { - return (byte[]) fieldsData; - } - } else - return null; - } - - @Override - public BytesRef binaryValue(BytesRef reuse) { - final byte[] bytes = getBinaryValue(reuse != null ? reuse.bytes : null); - if (bytes != null) { - return new BytesRef(bytes, 0, bytes.length); - } else { - return null; - } - } - } -} \ No newline at end of file Index: lucene/contrib/misc/src/java/org/apache/lucene/document2/LoadFirstFieldSelector.java =================================================================== --- lucene/contrib/misc/src/java/org/apache/lucene/document2/LoadFirstFieldSelector.java (revision 1153521) +++ lucene/contrib/misc/src/java/org/apache/lucene/document2/LoadFirstFieldSelector.java (working copy) @@ -1,29 +0,0 @@ -package org.apache.lucene.document2; -/** - * 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. - */ - - -/** - * Load the First field and break. - *
- * See {@link FieldSelectorResult#LOAD_AND_BREAK} - */ -public class LoadFirstFieldSelector implements FieldSelector { - - public FieldSelectorResult accept(String fieldName) { - return FieldSelectorResult.LOAD_AND_BREAK; - } -} \ No newline at end of file Index: lucene/contrib/misc/src/java/org/apache/lucene/document2/MapFieldSelector.java =================================================================== --- lucene/contrib/misc/src/java/org/apache/lucene/document2/MapFieldSelector.java (revision 1153521) +++ lucene/contrib/misc/src/java/org/apache/lucene/document2/MapFieldSelector.java (working copy) @@ -1,67 +0,0 @@ -package org.apache.lucene.document2; - -/** - * 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.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * A {@link FieldSelector} based on a Map of field names to {@link FieldSelectorResult}s - * - */ -public class MapFieldSelector implements FieldSelector { - - MapfieldsToLoad and lazyFieldsToLoad, lazy has precedence.
- *
- * @param fieldName The {@link Field} name to check
- * @return The {@link FieldSelectorResult}
- */
- public FieldSelectorResult accept(String fieldName) {
- FieldSelectorResult result = FieldSelectorResult.NO_LOAD;
- if (fieldsToLoad.contains(fieldName) == true){
- result = FieldSelectorResult.LOAD;
- }
- if (lazyFieldsToLoad.contains(fieldName) == true){
- result = FieldSelectorResult.LAZY_LOAD;
- }
- return result;
- }
-}
\ No newline at end of file
Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribFieldsReader.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribFieldsReader.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribFieldsReader.java (working copy)
@@ -22,13 +22,13 @@
import java.util.*;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldSelector;
-import org.apache.lucene.document2.FieldSelectorResult;
-import org.apache.lucene.document2.FieldSelectorVisitor;
-import org.apache.lucene.document2.LoadFirstFieldSelector;
-import org.apache.lucene.document2.SetBasedFieldSelector;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldSelector;
+import org.apache.lucene.document.FieldSelectorResult;
+import org.apache.lucene.document.FieldSelectorVisitor;
+import org.apache.lucene.document.LoadFirstFieldSelector;
+import org.apache.lucene.document.SetBasedFieldSelector;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.AlreadyClosedException;
import org.apache.lucene.store.Directory;
@@ -40,7 +40,7 @@
public class TestContribFieldsReader extends LuceneTestCase {
private static Directory dir;
- private static org.apache.lucene.document2.Document testDoc = new org.apache.lucene.document2.Document();
+ private static org.apache.lucene.document.Document testDoc = new org.apache.lucene.document.Document();
private static FieldInfos fieldInfos = null;
@BeforeClass
@@ -243,7 +243,7 @@
IndexReader reader = IndexReader.open(tmpDir);
Document doc;
- doc = reader.document2(0);//Load all of them
+ doc = reader.document(0);//Load all of them
assertTrue("doc is null and it shouldn't be", doc != null);
IndexableField field = doc.getField(DocHelper.LARGE_LAZY_FIELD_KEY);
assertTrue("field is null and it shouldn't be", field != null);
Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java (working copy)
@@ -23,14 +23,14 @@
import java.util.Set;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldSelector;
-import org.apache.lucene.document2.FieldSelectorVisitor;
-import org.apache.lucene.document2.SetBasedFieldSelector;
-import org.apache.lucene.document2.BinaryField;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.BinaryField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldSelector;
+import org.apache.lucene.document.FieldSelectorVisitor;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.SetBasedFieldSelector;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
@@ -137,7 +137,7 @@
writer.addDocument(doc);
writer.close();
IndexReader reader = IndexReader.open(dir, false);
- Document doc2 = reader.document2(reader.maxDoc() - 1);
+ Document doc2 = reader.document(reader.maxDoc() - 1);
IndexableField[] fields = doc2.getFields("bin1");
assertNotNull(fields);
assertEquals(1, fields.length);
@@ -171,7 +171,7 @@
writer.optimize();
writer.close();
reader = IndexReader.open(dir, false);
- doc2 = reader.document2(reader.maxDoc() - 1);
+ doc2 = reader.document(reader.maxDoc() - 1);
fields = doc2.getFields("bin1");
assertNotNull(fields);
assertEquals(1, fields.length);
Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribParallelReader.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribParallelReader.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribParallelReader.java (working copy)
@@ -22,12 +22,12 @@
import java.util.Random;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
-import org.apache.lucene.document2.FieldSelector;
-import org.apache.lucene.document2.FieldSelectorVisitor;
-import org.apache.lucene.document2.MapFieldSelector;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.FieldSelector;
+import org.apache.lucene.document.FieldSelectorVisitor;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.MapFieldSelector;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.search.*;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java (working copy)
@@ -21,10 +21,10 @@
import java.util.Arrays;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.search.Collector;
import org.apache.lucene.search.DefaultSimilarity;
Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestIndexSplitter.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/index/TestIndexSplitter.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestIndexSplitter.java (working copy)
@@ -19,7 +19,7 @@
import java.io.File;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.Document;
+import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestLazyBug.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/index/TestLazyBug.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestLazyBug.java (working copy)
@@ -22,11 +22,11 @@
import java.util.Set;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.FieldSelector;
-import org.apache.lucene.document2.FieldSelectorResult;
-import org.apache.lucene.document2.FieldSelectorVisitor;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.FieldSelector;
+import org.apache.lucene.document.FieldSelectorResult;
+import org.apache.lucene.document.FieldSelectorVisitor;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.AfterClass;
Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java (working copy)
@@ -17,10 +17,10 @@
*/
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.BytesRef;
@@ -77,7 +77,7 @@
IndexReader ir;
ir = IndexReader.open(dirs[0], true);
assertTrue(ir.numDocs() - NUM_DOCS / 3 <= 1); // rounding error
- Document doc = ir.document2(0);
+ Document doc = ir.document(0);
assertEquals("0", doc.get("id"));
TermsEnum te = MultiFields.getTerms(ir, "id").iterator();
assertEquals(TermsEnum.SeekStatus.NOT_FOUND, te.seek(new BytesRef("1")));
@@ -85,7 +85,7 @@
ir.close();
ir = IndexReader.open(dirs[1], true);
assertTrue(ir.numDocs() - NUM_DOCS / 3 <= 1);
- doc = ir.document2(0);
+ doc = ir.document(0);
assertEquals("1", doc.get("id"));
te = MultiFields.getTerms(ir, "id").iterator();
assertEquals(TermsEnum.SeekStatus.NOT_FOUND, te.seek(new BytesRef("0")));
@@ -94,7 +94,7 @@
ir.close();
ir = IndexReader.open(dirs[2], true);
assertTrue(ir.numDocs() - NUM_DOCS / 3 <= 1);
- doc = ir.document2(0);
+ doc = ir.document(0);
assertEquals("2", doc.get("id"));
te = MultiFields.getTerms(ir, "id").iterator();
@@ -122,19 +122,19 @@
IndexReader ir;
ir = IndexReader.open(dirs[0], true);
assertTrue(ir.numDocs() - NUM_DOCS / 3 <= 1);
- Document doc = ir.document2(0);
+ Document doc = ir.document(0);
assertEquals("0", doc.get("id"));
int start = ir.numDocs();
ir.close();
ir = IndexReader.open(dirs[1], true);
assertTrue(ir.numDocs() - NUM_DOCS / 3 <= 1);
- doc = ir.document2(0);
+ doc = ir.document(0);
assertEquals(start + "", doc.get("id"));
start += ir.numDocs();
ir.close();
ir = IndexReader.open(dirs[2], true);
assertTrue(ir.numDocs() - NUM_DOCS / 3 <= 1);
- doc = ir.document2(0);
+ doc = ir.document(0);
assertEquals(start + "", doc.get("id"));
// make sure the deleted doc is not here
TermsEnum te = MultiFields.getTerms(ir, "id").iterator();
Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java (working copy)
@@ -1,10 +1,10 @@
package org.apache.lucene.index;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
Index: lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java (working copy)
@@ -21,9 +21,9 @@
import java.util.Random;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.Fields;
import org.apache.lucene.index.IndexReader;
@@ -152,7 +152,7 @@
writer.close();
IndexReader reader = IndexReader.open(dir, null, true, 1, new AppendingCodecProvider());
assertEquals(2, reader.numDocs());
- Document doc2 = reader.document2(0);
+ Document doc2 = reader.document(0);
assertEquals(text, doc2.get("f"));
Fields fields = MultiFields.getFields(reader);
Terms terms = fields.terms("f");
Index: lucene/contrib/misc/src/test/org/apache/lucene/misc/TestHighFreqTerms.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/misc/TestHighFreqTerms.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/misc/TestHighFreqTerms.java (working copy)
@@ -19,10 +19,10 @@
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenizer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.store.Directory;
Index: lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java (working copy)
@@ -20,10 +20,10 @@
import java.io.IOException;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.Field;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.FieldNormModifier;
import org.apache.lucene.index.IndexReader;
Index: lucene/contrib/misc/src/test/org/apache/lucene/search/TestThreadSafe.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/search/TestThreadSafe.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/search/TestThreadSafe.java (working copy)
@@ -24,7 +24,7 @@
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.*;
+import org.apache.lucene.document.*;
import java.util.Random;
import java.util.List;
Index: lucene/contrib/misc/src/test/org/apache/lucene/store/TestNRTCachingDirectory.java
===================================================================
--- lucene/contrib/misc/src/test/org/apache/lucene/store/TestNRTCachingDirectory.java (revision 1153521)
+++ lucene/contrib/misc/src/test/org/apache/lucene/store/TestNRTCachingDirectory.java (working copy)
@@ -23,7 +23,7 @@
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.Document;
+import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
Index: lucene/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java
===================================================================
--- lucene/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java (revision 1153521)
+++ lucene/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java (working copy)
@@ -33,7 +33,7 @@
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-import org.apache.lucene.document2.Document;
+import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.Term;
@@ -801,7 +801,7 @@
o.println();
ScoreDoc[] scoreDocs = hits.scoreDocs;
for (int i = 0; i < Math.min(25, len); i++) {
- Document d = searcher.doc2(scoreDocs[i].doc);
+ Document d = searcher.doc(scoreDocs[i].doc);
String summary = d.get( "summary");
o.println("score : " + scoreDocs[i].score);
o.println("url : " + d.get("url"));
@@ -825,7 +825,7 @@
// field does not store term vector info
if (vector == null) {
- Document d=ir.document2(docNum);
+ Document d=ir.document(docNum);
IndexableField text[]=d.getFields(fieldName);
if(text!=null)
{
Index: lucene/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java
===================================================================
--- lucene/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java (revision 1153521)
+++ lucene/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java (working copy)
@@ -21,9 +21,9 @@
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenizer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.index.RandomIndexWriter;
Index: lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java
===================================================================
--- lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java (revision 1153521)
+++ lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java (working copy)
@@ -20,9 +20,9 @@
import java.util.Calendar;
import java.util.GregorianCalendar;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -131,13 +131,13 @@
TopDocs hits = searcher.search(query, chain, 1000);
numHits = hits.totalHits;
assertEquals(MAX / 2, numHits);
- assertEquals("bob", searcher.doc2(hits.scoreDocs[0].doc).get("owner"));
+ assertEquals("bob", searcher.doc(hits.scoreDocs[0].doc).get("owner"));
chain = getChainedFilter(new Filter[] {bobFilter}, new int[] {ChainedFilter.ANDNOT});
hits = searcher.search(query, chain, 1000);
numHits = hits.totalHits;
assertEquals(MAX / 2, numHits);
- assertEquals("sue", searcher.doc2(hits.scoreDocs[0].doc).get("owner"));
+ assertEquals("sue", searcher.doc(hits.scoreDocs[0].doc).get("owner"));
}
public void testOR() throws Exception {
@@ -154,7 +154,7 @@
TopDocs hits = searcher.search(query, chain, 1000);
assertEquals("AND matches just bob", MAX / 2, hits.totalHits);
- assertEquals("bob", searcher.doc2(hits.scoreDocs[0].doc).get("owner"));
+ assertEquals("bob", searcher.doc(hits.scoreDocs[0].doc).get("owner"));
}
public void testXOR() throws Exception {
@@ -163,7 +163,7 @@
TopDocs hits = searcher.search(query, chain, 1000);
assertEquals("XOR matches sue", MAX / 2, hits.totalHits);
- assertEquals("sue", searcher.doc2(hits.scoreDocs[0].doc).get("owner"));
+ assertEquals("sue", searcher.doc(hits.scoreDocs[0].doc).get("owner"));
}
public void testANDNOT() throws Exception {
@@ -174,7 +174,7 @@
TopDocs hits = searcher.search(query, chain, 1000);
assertEquals("ANDNOT matches just bob",
MAX / 2, hits.totalHits);
- assertEquals("bob", searcher.doc2(hits.scoreDocs[0].doc).get("owner"));
+ assertEquals("bob", searcher.doc(hits.scoreDocs[0].doc).get("owner"));
chain = getChainedFilter(
new Filter[]{bobFilter, bobFilter},
@@ -183,7 +183,7 @@
hits = searcher.search(query, chain, 1000);
assertEquals("ANDNOT bob ANDNOT bob matches all sues",
MAX / 2, hits.totalHits);
- assertEquals("sue", searcher.doc2(hits.scoreDocs[0].doc).get("owner"));
+ assertEquals("sue", searcher.doc(hits.scoreDocs[0].doc).get("owner"));
}
/*
Index: lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java
===================================================================
--- lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java (revision 1153521)
+++ lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java (working copy)
@@ -21,9 +21,9 @@
import java.util.HashSet;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document2.Document;
-import org.apache.lucene.document2.FieldType;
-import org.apache.lucene.document2.TextField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiFields;
@@ -93,7 +93,7 @@
ScoreDoc[] hits = searcher.search(tq,df, 1000).scoreDocs;
for(int i=0;i