You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2011/03/15 22:35:35 UTC
svn commit: r1081952 [3/17] - in /lucene/dev/branches/bulkpostings: ./
dev-tools/ dev-tools/eclipse/ dev-tools/idea/ dev-tools/idea/.idea/
dev-tools/idea/lucene/ dev-tools/idea/lucene/contrib/ant/
dev-tools/idea/lucene/contrib/demo/ dev-tools/idea/luce...
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java Tue Mar 15 21:35:17 2011
@@ -27,15 +27,11 @@ import java.util.Date;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Collector;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
-import org.apache.lucene.search.Scorer;
-import org.apache.lucene.search.TopScoreDocCollector;
+import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;
@@ -47,8 +43,7 @@ public class SearchFiles {
/** Simple command-line based search demo. */
public static void main(String[] args) throws Exception {
String usage =
- "Usage:\tjava org.apache.lucene.demo.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-raw] [-paging hitsPerPage]";
- usage += "\n\tSpecify 'false' for hitsPerPage to use streaming instead of paging search.";
+ "Usage:\tjava org.apache.lucene.demo.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-query string] [-raw] [-paging hitsPerPage]\n\nSee http://lucene.apache.org/java/4_0/demo.html for details.";
if (args.length > 0 && ("-h".equals(args[0]) || "-help".equals(args[0]))) {
System.out.println(usage);
System.exit(0);
@@ -59,10 +54,10 @@ public class SearchFiles {
String queries = null;
int repeat = 0;
boolean raw = false;
- boolean paging = true;
+ String queryString = null;
int hitsPerPage = 10;
- for (int i = 0; i < args.length; i++) {
+ for(int i = 0;i < args.length;i++) {
if ("-index".equals(args[i])) {
index = args[i+1];
i++;
@@ -72,28 +67,26 @@ public class SearchFiles {
} else if ("-queries".equals(args[i])) {
queries = args[i+1];
i++;
+ } else if ("-query".equals(args[i])) {
+ queryString = args[i+1];
+ i++;
} else if ("-repeat".equals(args[i])) {
repeat = Integer.parseInt(args[i+1]);
i++;
} else if ("-raw".equals(args[i])) {
raw = true;
} else if ("-paging".equals(args[i])) {
- if (args[i+1].equals("false")) {
- paging = false;
- } else {
- hitsPerPage = Integer.parseInt(args[i+1]);
- if (hitsPerPage == 0) {
- paging = false;
- }
+ hitsPerPage = Integer.parseInt(args[i+1]);
+ if (hitsPerPage <= 0) {
+ System.err.println("There must be at least 1 hit per page.");
+ System.exit(1);
}
i++;
}
}
- IndexReader reader = IndexReader.open(FSDirectory.open(new File(index)), true); // only searching, so read-only=true
-
- IndexSearcher searcher = new IndexSearcher(reader);
- Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);
+ IndexSearcher searcher = new IndexSearcher(FSDirectory.open(new File(index)));
+ Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_40);
BufferedReader in = null;
if (queries != null) {
@@ -101,23 +94,25 @@ public class SearchFiles {
} else {
in = new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
}
- QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, field, analyzer);
+ QueryParser parser = new QueryParser(Version.LUCENE_40, field, analyzer);
while (true) {
- if (queries == null) // prompt the user
+ if (queries == null && queryString == null) { // prompt the user
System.out.println("Enter query: ");
+ }
- String line = in.readLine();
+ String line = queryString != null ? queryString : in.readLine();
- if (line == null || line.length() == -1)
+ if (line == null || line.length() == -1) {
break;
+ }
line = line.trim();
- if (line.length() == 0)
+ if (line.length() == 0) {
break;
+ }
Query query = parser.parse(line);
System.out.println("Searching for: " + query.toString(field));
-
if (repeat > 0) { // repeat & time as benchmark
Date start = new Date();
@@ -128,52 +123,13 @@ public class SearchFiles {
System.out.println("Time: "+(end.getTime()-start.getTime())+"ms");
}
- if (paging) {
- doPagingSearch(in, searcher, query, hitsPerPage, raw, queries == null);
- } else {
- doStreamingSearch(searcher, query);
- }
- }
- reader.close();
- }
-
- /**
- * This method uses a custom HitCollector implementation which simply prints out
- * the docId and score of every matching document.
- *
- * This simulates the streaming search use case, where all hits are supposed to
- * be processed, regardless of their relevance.
- */
- public static void doStreamingSearch(final IndexSearcher searcher, Query query) throws IOException {
- Collector streamingHitCollector = new Collector() {
- private Scorer scorer;
- private int docBase;
-
- // simply print docId and score of every matching document
- @Override
- public void collect(int doc) throws IOException {
- System.out.println("doc=" + doc + docBase + " score=" + scorer.score());
- }
-
- @Override
- public boolean acceptsDocsOutOfOrder() {
- return true;
- }
-
- @Override
- public void setNextReader(AtomicReaderContext context)
- throws IOException {
- this.docBase = context.docBase;
- }
+ doPagingSearch(in, searcher, query, hitsPerPage, raw, queries == null && queryString == null);
- @Override
- public void setScorer(Scorer scorer) throws IOException {
- this.scorer = scorer;
+ if (queryString != null) {
+ break;
}
-
- };
-
- searcher.search(query, streamingHitCollector);
+ }
+ searcher.close();
}
/**
@@ -190,12 +146,10 @@ public class SearchFiles {
int hitsPerPage, boolean raw, boolean interactive) throws IOException {
// Collect enough docs to show 5 pages
- TopScoreDocCollector collector = TopScoreDocCollector.create(
- 5 * hitsPerPage, false);
- searcher.search(query, collector);
- ScoreDoc[] hits = collector.topDocs().scoreDocs;
+ TopDocs results = searcher.search(query, 5 * hitsPerPage);
+ ScoreDoc[] hits = results.scoreDocs;
- int numTotalHits = collector.getTotalHits();
+ int numTotalHits = results.totalHits;
System.out.println(numTotalHits + " total matching documents");
int start = 0;
@@ -210,9 +164,7 @@ public class SearchFiles {
break;
}
- collector = TopScoreDocCollector.create(numTotalHits, false);
- searcher.search(query, collector);
- hits = collector.topDocs().scoreDocs;
+ hits = searcher.search(query, numTotalHits).scoreDocs;
}
end = Math.min(hits.length, start + hitsPerPage);
@@ -237,7 +189,7 @@ public class SearchFiles {
}
- if (!interactive) {
+ if (!interactive || end == 0) {
break;
}
@@ -279,8 +231,6 @@ public class SearchFiles {
if (quit) break;
end = Math.min(numTotalHits, start + hitsPerPage);
}
-
}
-
}
}
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java Tue Mar 15 21:35:17 2011
@@ -24,43 +24,30 @@ import java.io.PrintStream;
import org.apache.lucene.util.LuceneTestCase;
public class TestDemo extends LuceneTestCase {
- // LUCENE-589
- public void testUnicodeHtml() throws Exception {
- File dir = getDataFile("test-files/html");
- File indexDir = new File(TEMP_DIR, "demoIndex");
- IndexHTML.main(new String[] { "-create", "-index", indexDir.getPath(), dir.getPath() });
- File queries = getDataFile("test-files/queries.txt");
+
+ private void testOneSearch(String query, int expectedHitCount) throws Exception {
PrintStream outSave = System.out;
try {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
PrintStream fakeSystemOut = new PrintStream(bytes);
System.setOut(fakeSystemOut);
- SearchFiles.main(new String[] { "-index", indexDir.getPath(), "-queries", queries.getPath()});
+ SearchFiles.main(new String[] {"-query", query});
fakeSystemOut.flush();
String output = bytes.toString(); // intentionally use default encoding
- assertTrue(output.contains("1 total matching documents"));
+ assertTrue("output=" + output, output.contains(expectedHitCount + " total matching documents"));
} finally {
System.setOut(outSave);
}
}
-
- // LUCENE-591
- public void testIndexKeywords() throws Exception {
- File dir = getDataFile("test-files/html");
- File indexDir = new File(TEMP_DIR, "demoIndex2");
- IndexHTML.main(new String[] { "-create", "-index", indexDir.getPath(), dir.getPath() });
- File queries = getDataFile("test-files/queries2.txt");
- PrintStream outSave = System.out;
- try {
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
- PrintStream fakeSystemOut = new PrintStream(bytes);
- System.setOut(fakeSystemOut);
- SearchFiles.main(new String[] { "-index", indexDir.getPath(), "-queries", queries.getPath()});
- fakeSystemOut.flush();
- String output = bytes.toString(); // intentionally use default encoding
- assertTrue(output.contains("1 total matching documents"));
- } finally {
- System.setOut(outSave);
- }
+
+ public void testIndexSearch() throws Exception {
+ File dir = getDataFile("test-files/docs");
+ IndexFiles.main(new String[] { "-create", "-docs", dir.getPath() });
+ testOneSearch("apache", 3);
+ testOneSearch("patent", 8);
+ testOneSearch("lucene", 0);
+ testOneSearch("gnu", 6);
+ testOneSearch("derivative", 8);
+ testOneSearch("license", 13);
}
}
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java Tue Mar 15 21:35:17 2011
@@ -524,7 +524,7 @@ class FragmentQueue extends PriorityQueu
{
public FragmentQueue(int size)
{
- initialize(size);
+ super(size);
}
@Override
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/package.html?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/package.html (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/package.html Tue Mar 15 21:35:17 2011
@@ -26,7 +26,7 @@ Fragmenter, fragment Scorer, and Formatt
<h2>Example Usage</h2>
-<pre>
+<pre class="prettyprint">
//... Above, create documents with two fields, one with term vectors (tv) and one without (notv)
IndexSearcher searcher = new IndexSearcher(directory);
QueryParser parser = new QueryParser("notv", analyzer);
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java Tue Mar 15 21:35:17 2011
@@ -828,7 +828,7 @@ public class HighlighterTest extends Bas
@Override
public void run() throws Exception {
numHighlights = 0;
- TermRangeFilter rf = new TermRangeFilter("contents", "john", "john", true, true);
+ TermRangeFilter rf = TermRangeFilter.newStringRange("contents", "john", "john", true, true);
SpanQuery clauses[] = { new SpanTermQuery(new Term("contents", "john")),
new SpanTermQuery(new Term("contents", "kennedy")), };
SpanNearQuery snq = new SpanNearQuery(clauses, 1, true);
@@ -851,7 +851,7 @@ public class HighlighterTest extends Bas
@Override
public void run() throws Exception {
numHighlights = 0;
- TermRangeFilter rf = new TermRangeFilter("contents", "john", "john", true, true);
+ TermRangeFilter rf = TermRangeFilter.newStringRange("contents", "john", "john", true, true);
PhraseQuery pq = new PhraseQuery();
pq.add(new Term("contents", "john"));
pq.add(new Term("contents", "kennedy"));
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java Tue Mar 15 21:35:17 2011
@@ -71,7 +71,7 @@ public class AppendingCodec extends Code
}
success = false;
try {
- FieldsConsumer ret = new AppendingTermsDictWriter(indexWriter, state, docsWriter, BytesRef.getUTF8SortedAsUnicodeComparator());
+ FieldsConsumer ret = new AppendingTermsDictWriter(indexWriter, state, docsWriter);
success = true;
return ret;
} finally {
@@ -111,7 +111,6 @@ public class AppendingCodec extends Code
state.dir, state.fieldInfos, state.segmentInfo.name,
docsReader,
state.readBufferSize,
- BytesRef.getUTF8SortedAsUnicodeComparator(),
StandardCodec.TERMS_CACHE_SIZE,
state.codecId);
success = true;
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java Tue Mar 15 21:35:17 2011
@@ -18,7 +18,6 @@ package org.apache.lucene.index.codecs.a
*/
import java.io.IOException;
-import java.util.Comparator;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.codecs.PostingsReaderBase;
@@ -27,7 +26,6 @@ import org.apache.lucene.index.codecs.Bl
import org.apache.lucene.index.codecs.TermsIndexReaderBase;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.CodecUtil;
public class AppendingTermsDictReader extends BlockTermsReader {
@@ -35,9 +33,9 @@ public class AppendingTermsDictReader ex
public AppendingTermsDictReader(TermsIndexReaderBase indexReader,
Directory dir, FieldInfos fieldInfos, String segment,
PostingsReaderBase postingsReader, int readBufferSize,
- Comparator<BytesRef> termComp, int termsCacheSize, String codecId) throws IOException {
+ int termsCacheSize, String codecId) throws IOException {
super(indexReader, dir, fieldInfos, segment, postingsReader, readBufferSize,
- termComp, termsCacheSize, codecId);
+ termsCacheSize, codecId);
}
@Override
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java Tue Mar 15 21:35:17 2011
@@ -18,23 +18,21 @@ package org.apache.lucene.index.codecs.a
*/
import java.io.IOException;
-import java.util.Comparator;
import org.apache.lucene.index.SegmentWriteState;
import org.apache.lucene.index.codecs.PostingsWriterBase;
import org.apache.lucene.index.codecs.BlockTermsWriter;
import org.apache.lucene.index.codecs.TermsIndexWriterBase;
import org.apache.lucene.store.IndexOutput;
-import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.CodecUtil;
public class AppendingTermsDictWriter extends BlockTermsWriter {
final static String CODEC_NAME = "APPENDING_TERMS_DICT";
public AppendingTermsDictWriter(TermsIndexWriterBase indexWriter,
- SegmentWriteState state, PostingsWriterBase postingsWriter,
- Comparator<BytesRef> termComp) throws IOException {
- super(indexWriter, state, postingsWriter, termComp);
+ SegmentWriteState state, PostingsWriterBase postingsWriter)
+ throws IOException {
+ super(indexWriter, state, postingsWriter);
}
@Override
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java Tue Mar 15 21:35:17 2011
@@ -249,7 +249,7 @@ final class TotalTermFreqComparatorSortD
**/
final class TermStatsQueue extends PriorityQueue<TermStats> {
TermStatsQueue(int size) {
- initialize(size);
+ super(size);
}
@Override
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/misc/src/java/org/apache/lucene/store/WindowsDirectory.java Tue Mar 15 21:35:17 2011
@@ -19,6 +19,8 @@ package org.apache.lucene.store;
import java.io.File;
import java.io.IOException;
+import org.apache.lucene.store.Directory; // javadoc
+import org.apache.lucene.store.NativeFSLockFactory; // javadoc
/**
* Native {@link Directory} implementation for Microsoft Windows.
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/java/org/apache/lucene/search/FuzzyLikeThisQuery.java Tue Mar 15 21:35:17 2011
@@ -335,7 +335,7 @@ public class FuzzyLikeThisQuery extends
private static class ScoreTermQueue extends PriorityQueue<ScoreTerm> {
public ScoreTermQueue(int size){
- initialize(size);
+ super(size);
}
/* (non-Javadoc)
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThis.java Tue Mar 15 21:35:17 2011
@@ -1006,7 +1006,7 @@ public final class MoreLikeThis {
*/
private static class FreqQ extends PriorityQueue<Object[]> {
FreqQ (int s) {
- initialize(s);
+ super(s);
}
@Override
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java Tue Mar 15 21:35:17 2011
@@ -70,7 +70,7 @@ public class BooleanFilterTest extends L
private Filter getRangeFilter(String field,String lowerPrice, String upperPrice)
{
- Filter f = new TermRangeFilter(field,lowerPrice,upperPrice,true,true);
+ Filter f = TermRangeFilter.newStringRange(field,lowerPrice,upperPrice,true,true);
return f;
}
private Filter getTermsFilter(String field,String text)
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java Tue Mar 15 21:35:17 2011
@@ -84,7 +84,7 @@ public class ChainedFilterTest extends L
//Date pastTheEnd = parseDate("2099 Jan 1");
// dateFilter = DateFilter.Before("date", pastTheEnd);
// just treat dates as strings and select the whole range for now...
- dateFilter = new TermRangeFilter("date","","ZZZZ",true,true);
+ dateFilter = TermRangeFilter.newStringRange("date","","ZZZZ",true,true);
bobFilter = new QueryWrapperFilter(
new TermQuery(new Term("owner", "bob")));
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/complexPhrase/ComplexPhraseQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/complexPhrase/ComplexPhraseQueryParser.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/complexPhrase/ComplexPhraseQueryParser.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/complexPhrase/ComplexPhraseQueryParser.java Tue Mar 15 21:35:17 2011
@@ -174,8 +174,7 @@ public class ComplexPhraseQueryParser ex
if (isPass2ResolvingPhrases) {
// Must use old-style RangeQuery in order to produce a BooleanQuery
// that can be turned into SpanOr clause
- TermRangeQuery rangeQuery = new TermRangeQuery(field, part1, part2, startInclusive, endInclusive,
- getRangeCollator());
+ TermRangeQuery rangeQuery = TermRangeQuery.newStringRange(field, part1, part2, startInclusive, endInclusive);
rangeQuery.setRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
return rangeQuery;
}
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/StandardQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/StandardQueryParser.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/StandardQueryParser.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/StandardQueryParser.java Tue Mar 15 21:35:17 2011
@@ -17,7 +17,6 @@ package org.apache.lucene.queryParser.st
* limitations under the License.
*/
-import java.text.Collator;
import java.util.Locale;
import java.util.Map;
import java.util.TooManyListenersException;
@@ -41,10 +40,8 @@ import org.apache.lucene.queryParser.sta
import org.apache.lucene.queryParser.standard.config.MultiFieldAttribute;
import org.apache.lucene.queryParser.standard.config.MultiTermRewriteMethodAttribute;
import org.apache.lucene.queryParser.standard.config.PositionIncrementsAttribute;
-import org.apache.lucene.queryParser.standard.config.RangeCollatorAttribute;
import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler;
import org.apache.lucene.queryParser.standard.config.DefaultOperatorAttribute.Operator;
-import org.apache.lucene.queryParser.standard.nodes.RangeQueryNode;
import org.apache.lucene.queryParser.standard.parser.StandardSyntaxParser;
import org.apache.lucene.queryParser.standard.processors.StandardQueryNodeProcessorPipeline;
import org.apache.lucene.search.FuzzyQuery;
@@ -188,32 +185,6 @@ public class StandardQueryParser extends
}
/**
- * Sets the collator used to determine index term inclusion in ranges for
- * RangeQuerys.
- * <p/>
- * <strong>WARNING:</strong> Setting the rangeCollator to a non-null collator
- * using this method will cause every single index Term in the Field
- * referenced by lowerTerm and/or upperTerm to be examined. Depending on the
- * number of index Terms in this Field, the operation could be very slow.
- *
- * @param collator
- * the collator to use when constructing {@link RangeQueryNode}s
- */
- public void setRangeCollator(Collator collator) {
- RangeCollatorAttribute attr = getQueryConfigHandler().getAttribute(RangeCollatorAttribute.class);
- attr.setDateResolution(collator);
- }
-
- /**
- * @return the collator used to determine index term inclusion in ranges for
- * RangeQuerys.
- */
- public Collator getRangeCollator() {
- RangeCollatorAttribute attr = getQueryConfigHandler().getAttribute(RangeCollatorAttribute.class);
- return attr.getRangeCollator();
- }
-
- /**
* Sets the boolean operator of the QueryParser. In default mode (
* {@link Operator#OR}) terms without any modifiers are considered optional:
* for example <code>capital of Hungary</code> is equal to
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/RangeQueryNodeBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/RangeQueryNodeBuilder.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/RangeQueryNodeBuilder.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/builders/RangeQueryNodeBuilder.java Tue Mar 15 21:35:17 2011
@@ -53,9 +53,7 @@ public class RangeQueryNodeBuilder imple
String field = rangeNode.getField().toString();
- TermRangeQuery rangeQuery = new TermRangeQuery(field, lower
- .getTextAsString(), upper.getTextAsString(), lowerInclusive,
- upperInclusive, rangeNode.getCollator());
+ TermRangeQuery rangeQuery = TermRangeQuery.newStringRange(field, lower.getTextAsString(), upper.getTextAsString(), lowerInclusive, upperInclusive);
MultiTermQuery.RewriteMethod method = (MultiTermQuery.RewriteMethod)queryNode.getTag(MultiTermRewriteMethodAttribute.TAG_ID);
if (method != null) {
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/StandardQueryConfigHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/StandardQueryConfigHandler.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/StandardQueryConfigHandler.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/StandardQueryConfigHandler.java Tue Mar 15 21:35:17 2011
@@ -38,7 +38,6 @@ public class StandardQueryConfigHandler
addFieldConfigListener(new FieldDateResolutionFCListener(this));
// Default Values
- addAttribute(RangeCollatorAttribute.class);
addAttribute(DefaultOperatorAttribute.class);
addAttribute(AnalyzerAttribute.class);
addAttribute(FuzzyAttribute.class);
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/nodes/RangeQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/nodes/RangeQueryNode.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/nodes/RangeQueryNode.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/nodes/RangeQueryNode.java Tue Mar 15 21:35:17 2011
@@ -17,34 +17,24 @@ package org.apache.lucene.queryParser.st
* limitations under the License.
*/
-import java.text.Collator;
-
import org.apache.lucene.queryParser.core.nodes.ParametricQueryNode;
import org.apache.lucene.queryParser.core.nodes.ParametricRangeQueryNode;
-import org.apache.lucene.queryParser.standard.config.RangeCollatorAttribute;
import org.apache.lucene.queryParser.standard.processors.ParametricRangeQueryNodeProcessor;
/**
- * This query node represents a range query. It also holds which collator will
- * be used by the range query and if the constant score rewrite is enabled. <br/>
+ * This query node represents a range query.
*
* @see ParametricRangeQueryNodeProcessor
- * @see RangeCollatorAttribute
* @see org.apache.lucene.search.TermRangeQuery
*/
public class RangeQueryNode extends ParametricRangeQueryNode {
- private Collator collator;
-
/**
* @param lower
* @param upper
*/
- public RangeQueryNode(ParametricQueryNode lower, ParametricQueryNode upper, Collator collator) {
+ public RangeQueryNode(ParametricQueryNode lower, ParametricQueryNode upper) {
super(lower, upper);
-
- this.collator = collator;
-
}
@Override
@@ -57,12 +47,4 @@ public class RangeQueryNode extends Para
return sb.toString();
}
-
- /**
- * @return the collator
- */
- public Collator getCollator() {
- return this.collator;
- }
-
}
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/ParametricRangeQueryNodeProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/ParametricRangeQueryNodeProcessor.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/ParametricRangeQueryNodeProcessor.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/processors/ParametricRangeQueryNodeProcessor.java Tue Mar 15 21:35:17 2011
@@ -17,7 +17,6 @@ package org.apache.lucene.queryParser.st
* limitations under the License.
*/
-import java.text.Collator;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -36,7 +35,6 @@ import org.apache.lucene.queryParser.cor
import org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl;
import org.apache.lucene.queryParser.standard.config.DateResolutionAttribute;
import org.apache.lucene.queryParser.standard.config.LocaleAttribute;
-import org.apache.lucene.queryParser.standard.config.RangeCollatorAttribute;
import org.apache.lucene.queryParser.standard.nodes.RangeQueryNode;
/**
@@ -54,12 +52,7 @@ import org.apache.lucene.queryParser.sta
* If a {@link DateResolutionAttribute} is defined and the {@link Resolution} is
* not <code>null</code> it will also be used to parse the date value. <br/>
* <br/>
- * This processor will also try to retrieve a {@link RangeCollatorAttribute}
- * from the {@link QueryConfigHandler}. If a {@link RangeCollatorAttribute} is
- * found and the {@link Collator} is not <code>null</code>, it's set on the
- * {@link RangeQueryNode}. <br/>
*
- * @see RangeCollatorAttribute
* @see DateResolutionAttribute
* @see LocaleAttribute
* @see RangeQueryNode
@@ -79,17 +72,9 @@ public class ParametricRangeQueryNodePro
ParametricQueryNode upper = parametricRangeNode.getUpperBound();
ParametricQueryNode lower = parametricRangeNode.getLowerBound();
Locale locale = Locale.getDefault();
- Collator collator = null;
DateTools.Resolution dateRes = null;
boolean inclusive = false;
- if (getQueryConfigHandler().hasAttribute(RangeCollatorAttribute.class)) {
-
- collator = getQueryConfigHandler().getAttribute(
- RangeCollatorAttribute.class).getRangeCollator();
-
- }
-
if (getQueryConfigHandler().hasAttribute(LocaleAttribute.class)) {
locale = getQueryConfigHandler().getAttribute(LocaleAttribute.class)
@@ -155,7 +140,7 @@ public class ParametricRangeQueryNodePro
lower.setText(part1);
upper.setText(part2);
- return new RangeQueryNode(lower, upper, collator);
+ return new RangeQueryNode(lower, upper);
}
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/overview.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/overview.html?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/overview.html (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/java/overview.html Tue Mar 15 21:35:17 2011
@@ -131,7 +131,7 @@ you don't need to worry about dealing wi
{@link org.apache.lucene.queryParser.standard.StandardQueryParser} usage:
-<pre>
+<pre class="prettyprint">
StandardQueryParser qpHelper = new StandardQueryParser();
StandardQueryConfigHandler config = qpHelper.getQueryConfigHandler();
config.setAllowLeadingWildcard(true);
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java Tue Mar 15 21:35:17 2011
@@ -642,55 +642,6 @@ public class TestQPHelper extends Lucene
"gack (bar blar {a TO z})");
}
- public void testFarsiRangeCollating() throws Exception {
- Directory ramDir = newDirectory();
- IndexWriter iw = new IndexWriter(ramDir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.WHITESPACE, false)));
- Document doc = new Document();
- doc.add(newField("content", "\u0633\u0627\u0628", Field.Store.YES,
- Field.Index.NOT_ANALYZED));
- iw.addDocument(doc);
- iw.close();
- IndexSearcher is = new IndexSearcher(ramDir, true);
-
- StandardQueryParser qp = new StandardQueryParser();
- qp.setAnalyzer(new MockAnalyzer(MockTokenizer.WHITESPACE, false));
-
- // Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
- // RuleBasedCollator. However, the Arabic Locale seems to order the
- // Farsi
- // characters properly.
- Collator c = Collator.getInstance(new Locale("ar"));
- qp.setRangeCollator(c);
-
- // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
- // orders the U+0698 character before the U+0633 character, so the
- // single
- // index Term below should NOT be returned by a ConstantScoreRangeQuery
- // with a Farsi Collator (or an Arabic one for the case when Farsi is
- // not
- // supported).
-
- // Test ConstantScoreRangeQuery
- qp.setMultiTermRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
- ScoreDoc[] result = is.search(qp.parse("[ \u062F TO \u0698 ]", "content"),
- null, 1000).scoreDocs;
- assertEquals("The index Term should not be included.", 0, result.length);
-
- result = is.search(qp.parse("[ \u0633 TO \u0638 ]", "content"), null, 1000).scoreDocs;
- assertEquals("The index Term should be included.", 1, result.length);
-
- // Test RangeQuery
- qp.setMultiTermRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
- result = is.search(qp.parse("[ \u062F TO \u0698 ]", "content"), null, 1000).scoreDocs;
- assertEquals("The index Term should not be included.", 0, result.length);
-
- result = is.search(qp.parse("[ \u0633 TO \u0638 ]", "content"), null, 1000).scoreDocs;
- assertEquals("The index Term should be included.", 1, result.length);
-
- is.close();
- ramDir.close();
- }
-
/** for testing DateTools support */
private String getDate(String s, DateTools.Resolution resolution)
throws Exception {
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/config/TestAttributes.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/config/TestAttributes.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/config/TestAttributes.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/config/TestAttributes.java Tue Mar 15 21:35:17 2011
@@ -60,8 +60,6 @@ public class TestAttributes extends Luce
Collections.singletonMap(MultiTermRewriteMethodAttribute.class.getName()+"#multiTermRewriteMethod", MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT));
_TestUtil.assertAttributeReflection(new PositionIncrementsAttributeImpl(),
Collections.singletonMap(PositionIncrementsAttribute.class.getName()+"#positionIncrementsEnabled", false));
- _TestUtil.assertAttributeReflection(new RangeCollatorAttributeImpl(),
- Collections.singletonMap(RangeCollatorAttribute.class.getName()+"#rangeCollator", null));
}
}
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java Tue Mar 15 21:35:17 2011
@@ -41,7 +41,7 @@ public final class SuggestWordQueue exte
* @param size The size of the queue
*/
public SuggestWordQueue (int size) {
- initialize(size);
+ super(size);
comparator = DEFAULT_COMPARATOR;
}
@@ -51,7 +51,7 @@ public final class SuggestWordQueue exte
* @param comparator The comparator.
*/
public SuggestWordQueue(int size, Comparator<SuggestWord> comparator){
- initialize(size);
+ super(size);
this.comparator = comparator;
}
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/RangeFilterBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/RangeFilterBuilder.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/RangeFilterBuilder.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/RangeFilterBuilder.java Tue Mar 15 21:35:17 2011
@@ -41,7 +41,7 @@ public class RangeFilterBuilder implemen
String upperTerm=e.getAttribute("upperTerm");
boolean includeLower=DOMUtils.getAttribute(e,"includeLower",true);
boolean includeUpper=DOMUtils.getAttribute(e,"includeUpper",true);
- return new TermRangeFilter(fieldName,lowerTerm,upperTerm,includeLower,includeUpper);
+ return TermRangeFilter.newStringRange(fieldName,lowerTerm,upperTerm,includeLower,includeUpper);
}
}
Modified: lucene/dev/branches/bulkpostings/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java Tue Mar 15 21:35:17 2011
@@ -21,6 +21,7 @@ import org.apache.lucene.store.Directory
import org.apache.lucene.util.Version;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.AfterClass;
+import org.junit.Assume;
import org.junit.BeforeClass;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -186,6 +187,7 @@ public class TestParser extends LuceneTe
}
public void testDuplicateFilterQueryXML() throws ParserException, IOException
{
+ Assume.assumeTrue(searcher.getIndexReader().getSequentialSubReaders().length == 1);
Query q=parse("DuplicateFilterQuery.xml");
int h = searcher.search(q, null, 1000).totalHits;
assertEquals("DuplicateFilterQuery should produce 1 result ", 1,h);
Modified: lucene/dev/branches/bulkpostings/lucene/docs/contributions.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/docs/contributions.html?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/docs/contributions.html (original)
+++ lucene/dev/branches/bulkpostings/lucene/docs/contributions.html Tue Mar 15 21:35:17 2011
@@ -130,7 +130,7 @@ document.write("Last Published: " + docu
<a href="api/core/index.html">Core</a>
</div>
<div class="menuitem">
-<a href="api/demo/index.html">Demo</a>
+<a href="api/test-framework/index.html">Test Framework</a>
</div>
<div onclick="SwitchMenu('menu_1.1.3.4', 'skin/')" id="menu_1.1.3.4Title" class="menutitle">Contrib</div>
<div id="menu_1.1.3.4" class="menuitemgroup">
@@ -147,6 +147,9 @@ document.write("Last Published: " + docu
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-demo/index.html">Demo</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
Modified: lucene/dev/branches/bulkpostings/lucene/docs/demo.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/docs/demo.html?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/docs/demo.html (original)
+++ lucene/dev/branches/bulkpostings/lucene/docs/demo.html Tue Mar 15 21:35:17 2011
@@ -130,7 +130,7 @@ document.write("Last Published: " + docu
<a href="api/core/index.html">Core</a>
</div>
<div class="menuitem">
-<a href="api/demo/index.html">Demo</a>
+<a href="api/test-framework/index.html">Test Framework</a>
</div>
<div onclick="SwitchMenu('menu_1.1.3.4', 'skin/')" id="menu_1.1.3.4Title" class="menutitle">Contrib</div>
<div id="menu_1.1.3.4" class="menuitemgroup">
@@ -147,6 +147,9 @@ document.write("Last Published: " + docu
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-demo/index.html">Demo</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
@@ -243,7 +246,7 @@ document.write("Last Published: " + docu
<a href="#About this Document">About this Document</a>
</li>
<li>
-<a href="#About the Demos">About the Demos</a>
+<a href="#About the Demo">About the Demo</a>
</li>
<li>
<a href="#Setting your CLASSPATH">Setting your CLASSPATH</a>
@@ -269,12 +272,12 @@ It walks you through some basic installa
-<a name="N1001C"></a><a name="About the Demos"></a>
-<h2 class="boxed">About the Demos</h2>
+<a name="N1001C"></a><a name="About the Demo"></a>
+<h2 class="boxed">About the Demo</h2>
<div class="section">
<p>
-The Lucene command-line demo code consists of two applications that demonstrate various
-functionalities of Lucene and how one should go about adding Lucene to their applications.
+The Lucene command-line demo code consists of an application that demonstrates various
+functionalities of Lucene and how you can add Lucene to your applications.
</p>
</div>
@@ -284,20 +287,21 @@ functionalities of Lucene and how one sh
<div class="section">
<p>
First, you should <a href="http://www.apache.org/dyn/closer.cgi/lucene/java/">download</a> the
-latest Lucene distribution and then extract it to a working directory. Alternatively, you can <a href="http://wiki.apache.org/lucene-java/SourceRepository">check out the sources from
-Subversion</a>, and then run <span class="codefrag">ant war-demo</span> to generate the JARs and WARs.
+latest Lucene distribution and then extract it to a working directory.
+</p>
+<p>
+You need three JARs: the Lucene JAR, the common analysis JAR, and the Lucene demo JAR. You should
+see the Lucene JAR file in the directory you created when you extracted the archive -- it
+should be named something like <span class="codefrag">lucene-core-{version}.jar</span>. You should also see files
+called <span class="codefrag">lucene-analyzers-common-{version}.jar</span> and <span class="codefrag">lucene-demo-{version}.jar</span>.
</p>
<p>
-You should see the Lucene JAR file in the directory you created when you extracted the archive. It
-should be named something like <span class="codefrag">lucene-core-{version}.jar</span>. You should also see a file
-called <span class="codefrag">lucene-demos-{version}.jar</span>. If you checked out the sources from Subversion then
-the JARs are located under the <span class="codefrag">build</span> subdirectory (after running <span class="codefrag">ant</span>
-successfully). Put both of these files in your Java CLASSPATH.
+Put all three of these files in your Java CLASSPATH.
</p>
</div>
-<a name="N10048"></a><a name="Indexing Files"></a>
+<a name="N10041"></a><a name="Indexing Files"></a>
<h2 class="boxed">Indexing Files</h2>
<div class="section">
<p>
@@ -305,7 +309,7 @@ Once you've gotten this far you're proba
you've set your CLASSPATH correctly, just type:
<pre>
- java org.apache.lucene.demo.IndexFiles {full-path-to-lucene}/src
+ java org.apache.lucene.demo.IndexFiles -docs {path-to-lucene}/src
</pre>
This will produce a subdirectory called <span class="codefrag">index</span> which will contain an index of all of the
@@ -326,7 +330,7 @@ you whether you want more results.
</div>
-<a name="N10063"></a><a name="About the code..."></a>
+<a name="N1005C"></a><a name="About the code..."></a>
<h2 class="boxed">About the code...</h2>
<div class="section">
<p>
Modified: lucene/dev/branches/bulkpostings/lucene/docs/demo.pdf
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/docs/demo.pdf?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/docs/demo.pdf (original)
+++ lucene/dev/branches/bulkpostings/lucene/docs/demo.pdf Tue Mar 15 21:35:17 2011
@@ -5,10 +5,10 @@
/Producer (FOP 0.20.5) >>
endobj
5 0 obj
-<< /Length 615 /Filter [ /ASCII85Decode /FlateDecode ]
+<< /Length 617 /Filter [ /ASCII85Decode /FlateDecode ]
>>
stream
-Gaua<9lHd\&;KZO$6PI!?%6<CP-iV[<N3S;[rr8rS-4]$>qk[>h\QrZS[;SS9*tq%RUKg"Z-=iJi,V6e@1\!3'-R1n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J(4A[sLM@tLOcXRd+^rZ)/3&IMi;bG%dq`6,GK0U$*sfn^&VPg9WS^?D]@gA+bY(u`1Fq:]+u?&r?COKcb)%9bj([2fqH4T\Tt^V8FGq+~>
endstream
endobj
6 0 obj
@@ -42,7 +42,7 @@ endobj
10 0 obj
<< /Type /Annot
/Subtype /Link
-/Rect [ 102.0 500.966 194.66 488.966 ]
+/Rect [ 102.0 500.966 189.992 488.966 ]
/C [ 0 0 0 ]
/Border [ 0 0 0 ]
/A 11 0 R
@@ -80,10 +80,10 @@ endobj
>>
endobj
18 0 obj
-<< /Length 2210 /Filter [ /ASCII85Decode /FlateDecode ]
+<< /Length 2057 /Filter [ /ASCII85Decode /FlateDecode ]
>>
stream
-Gatm=gQ(#H&:O:SW;D_\L`''6pE@=idS1AXBppnU'MTZ_M7/\77>IVg0nT=M8,&].\o&DhfNh)n3HO?,n-jBESGfa`I@f+;>"#f7<PL[hX5CY)Lb)2:/G%$qYH6Eo-FOZa*rP[.lL-b+$$AC(EbdQ0I<Mre4hD.T>(*V[cYRAQK,*;d[@4(d$_I[TEbG@DR$&iJgo6WcI(^/h)MW!r(;o@4Ls$gbiVhZbnkJ-HXd=Le>3'uT$A-PM)!Mh3(3LORFDDjg]Wa,&WU6)F4*FEhgGDto:O"WW@H]9^rk-s(V:'`I4=Lu.MC2KCP>.Gl*-j/k^WSs5bAstb/G!+nX0u],[q3d)hVtC/Ce)EXI89Q4'IX6jOhV-eh'8hXU;U8-;/Wh`/$VI2Y?6q,(bK\fbEtmjDK$p<q)[>rZMoU:0`OqKqGBYnJJ`%AWkmbO+UMt__9"]-<93ht$;Vm<rEqorfD2TqomNG`\s->m"aN@Q[f]aq=c/hP6,qe-g5N[8$\dRkf#Y<&R`P4"/</rq("dr3oW97g&4X%I"-]]4M^^:TSjUB?[<7nXe`n\Y<QYatNEt+;ZkWg&$\)2n7@Bi&2qTiJTI`[AZl8Cho+Q_Jb%ZZ\.#ArL(uTcHM(:mr;1l'18:3?K99A#OO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t8BNMG&i8`CLDQH*eE<Cb*@pq,C?;NGT\g`p9T1bO<*'c'#DRAP@roTl1L\RJG,c+#^_TWnnI<Y0p^eqFNid<F(H/kH0@YQMatBn?2&#YrdYn@&^'l/9Qu'^Rb7?VR^%)BQh^AtR#kiIN[AFBp1P7F(`>Qs?#R/\J!l[ps;m?P!`:`Mn+eLImPT5%oB$_JQ0j->H*94ZF*>do.IUr?8X9*@(p[.@+'D^_=]_E#MP\QC++i[!kJ^^[[p8UrEd"et_:>h;>n"\gNKNuEqB@!.Y`J.QYdMST:,2t\H'fmsekc0hcfqqLj"123b!QBUS]NT'F/(L#W,&2@J,0;NfeQk@6Vod%m=8eEGn7I!5Vlm<ejE='\s(!dP:g]W+gRHBS_Y!r,)nFN,qSVfUp?a:QL<V,%QXb7%#1h/Jo?e#YUTOY#hhjNMSC<=@cM'h+A9m
M>0N.WES,1DiU:))$UJork"(_%II)EGaE(ZSTRqpk[Bn%Qn/F.o")mjtDBFIB8EQ:tq\,QGXNPl\~>
endstream
endobj
19 0 obj
@@ -103,7 +103,7 @@ endobj
>> endobj
22 0 obj
<<
- /Title (\376\377\0\62\0\40\0\101\0\142\0\157\0\165\0\164\0\40\0\164\0\150\0\145\0\40\0\104\0\145\0\155\0\157\0\163)
+ /Title (\376\377\0\62\0\40\0\101\0\142\0\157\0\165\0\164\0\40\0\164\0\150\0\145\0\40\0\104\0\145\0\155\0\157)
/Parent 20 0 R
/Prev 21 0 R
/Next 23 0 R
@@ -212,13 +212,13 @@ endobj
15 0 obj
<<
/S /GoTo
-/D [19 0 R /XYZ 85.0 375.198 null]
+/D [19 0 R /XYZ 85.0 367.198 null]
>>
endobj
17 0 obj
<<
/S /GoTo
-/D [19 0 R /XYZ 85.0 209.264 null]
+/D [19 0 R /XYZ 85.0 201.264 null]
>>
endobj
20 0 obj
@@ -229,37 +229,37 @@ endobj
xref
0 32
0000000000 65535 f
-0000005712 00000 n
-0000005777 00000 n
-0000005869 00000 n
+0000005556 00000 n
+0000005621 00000 n
+0000005713 00000 n
0000000015 00000 n
0000000071 00000 n
-0000000777 00000 n
-0000000897 00000 n
-0000000950 00000 n
-0000006003 00000 n
-0000001085 00000 n
-0000006066 00000 n
-0000001221 00000 n
-0000006132 00000 n
-0000001357 00000 n
-0000006198 00000 n
-0000001492 00000 n
-0000006264 00000 n
-0000001628 00000 n
-0000003931 00000 n
-0000006330 00000 n
-0000004039 00000 n
-0000004242 00000 n
-0000004436 00000 n
-0000004672 00000 n
-0000004861 00000 n
-0000005050 00000 n
-0000005163 00000 n
-0000005273 00000 n
-0000005381 00000 n
-0000005487 00000 n
-0000005603 00000 n
+0000000779 00000 n
+0000000899 00000 n
+0000000952 00000 n
+0000005847 00000 n
+0000001087 00000 n
+0000005910 00000 n
+0000001224 00000 n
+0000005976 00000 n
+0000001360 00000 n
+0000006042 00000 n
+0000001495 00000 n
+0000006108 00000 n
+0000001631 00000 n
+0000003781 00000 n
+0000006174 00000 n
+0000003889 00000 n
+0000004092 00000 n
+0000004280 00000 n
+0000004516 00000 n
+0000004705 00000 n
+0000004894 00000 n
+0000005007 00000 n
+0000005117 00000 n
+0000005225 00000 n
+0000005331 00000 n
+0000005447 00000 n
trailer
<<
/Size 32
@@ -267,5 +267,5 @@ trailer
/Info 4 0 R
>>
startxref
-6381
+6225
%%EOF
Modified: lucene/dev/branches/bulkpostings/lucene/docs/demo2.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/docs/demo2.html?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/docs/demo2.html (original)
+++ lucene/dev/branches/bulkpostings/lucene/docs/demo2.html Tue Mar 15 21:35:17 2011
@@ -130,7 +130,7 @@ document.write("Last Published: " + docu
<a href="api/core/index.html">Core</a>
</div>
<div class="menuitem">
-<a href="api/demo/index.html">Demo</a>
+<a href="api/test-framework/index.html">Test Framework</a>
</div>
<div onclick="SwitchMenu('menu_1.1.3.4', 'skin/')" id="menu_1.1.3.4Title" class="menutitle">Contrib</div>
<div id="menu_1.1.3.4" class="menuitemgroup">
@@ -147,6 +147,9 @@ document.write("Last Published: " + docu
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-demo/index.html">Demo</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
@@ -251,9 +254,6 @@ document.write("Last Published: " + docu
<li>
<a href="#Searching Files">Searching Files</a>
</li>
-<li>
-<a href="#The Web example...">The Web example...</a>
-</li>
</ul>
</div>
@@ -274,10 +274,14 @@ how to use Lucene in their applications.
<h2 class="boxed">Location of the source</h2>
<div class="section">
<p>
-Relative to the directory created when you extracted Lucene or retrieved it from Subversion, you
-should see a directory called <span class="codefrag">src</span> which in turn contains a directory called
-<span class="codefrag">demo</span>. This is the root for all of the Lucene demos. Under this directory is
-<span class="codefrag">org/apache/lucene/demo</span>. This is where all the Java sources for the demos live.
+NOTE: to examine the sources, you need to download and extract a source checkout of
+Lucene: (lucene-{version}-src.zip).
+</p>
+<p>
+Relative to the directory created when you extracted Lucene, you
+should see a directory called <span class="codefrag">lucene/contrib/demo/</span>. This is the root for the Lucene
+demo. Under this directory is <span class="codefrag">src/java/org/apache/lucene/demo/</span>. This is where all
+the Java sources for the demo live.
</p>
<p>
Within this directory you should see the <span class="codefrag">IndexFiles.java</span> class we executed earlier.
@@ -290,90 +294,103 @@ Bring it up in <span class="codefrag">vi
<h2 class="boxed">IndexFiles</h2>
<div class="section">
<p>
-As we discussed in the previous walk-through, the <a href="api/demo/org/apache/lucene/demo/IndexFiles.html">IndexFiles</a> class creates a Lucene
+As we discussed in the previous walk-through, the <a href="api/contrib-demo/org/apache/lucene/demo/IndexFiles.html">IndexFiles</a> class creates a Lucene
Index. Let's take a look at how it does this.
</p>
<p>
-The first substantial thing the <span class="codefrag">main</span> function does is instantiate <a href="api/core/org/apache/lucene/index/IndexWriter.html">IndexWriter</a>. It passes the string
-"<span class="codefrag">index</span>" and a new instance of a class called <a href="api/core/org/apache/lucene/analysis/standard/StandardAnalyzer.html">StandardAnalyzer</a>.
-The "<span class="codefrag">index</span>" string is the name of the filesystem directory where all index information
-should be stored. Because we're not passing a full path, this will be created as a subdirectory of
-the current working directory (if it does not already exist). On some platforms, it may be created
-in other directories (such as the user's home directory).
+The <span class="codefrag">main()</span> method parses the command-line parameters, then in preparation for
+instantiating <a href="api/core/org/apache/lucene/index/IndexWriter.html">IndexWriter</a>, opens a
+<a href="api/core/org/apache/lucene/store/Directory.html">Directory</a> and instantiates
+<a href="api/module-analysis-common/org/apache/lucene/analysis/standard/StandardAnalyzer.html">StandardAnalyzer</a> and
+<a href="api/core/org/apache/lucene/index/IndexWriterConfig.html">IndexWriterConfig</a>.
+</p>
+<p>
+The value of the <span class="codefrag">-index</span> command-line parameter is the name of the filesystem directory
+where all index information should be stored. If <span class="codefrag">IndexFiles</span> is invoked with a
+relative path given in the <span class="codefrag">-index</span> command-line parameter, or if the <span class="codefrag">-index</span>
+command-line parameter is not given, causing the default relative index path "<span class="codefrag">index</span>"
+to be used, the index path will be created as a subdirectory of the current working directory
+(if it does not already exist). On some platforms, the index path may be created in a different
+directory (such as the user's home directory).
+</p>
+<p>
+The <span class="codefrag">-docs</span> command-line parameter value is the location of the directory containing
+files to be indexed.
+</p>
+<p>
+The <span class="codefrag">-update</span> command-line parameter tells <span class="codefrag">IndexFiles</span> not to delete the
+index if it already exists. When <span class="codefrag">-update</span> is not given, <span class="codefrag">IndexFiles</span> will
+first wipe the slate clean before indexing any documents.
</p>
<p>
-The <a href="api/core/org/apache/lucene/index/IndexWriter.html">IndexWriter</a> is the main
-class responsible for creating indices. To use it you must instantiate it with a path that it can
-write the index into. If this path does not exist it will first create it. Otherwise it will
-refresh the index at that path. You can also create an index using one of the subclasses of <a href="api/core/org/apache/lucene/store/Directory.html">Directory</a>. In any case, you must also pass an
-instance of <a href="api/core/org/apache/lucene/analysis/Analyzer.html">org.apache.lucene.analysis.Analyzer</a>.
+Lucene <a href="api/core/org/apache/lucene/store/Directory.html">Directory</a>s are used by the
+<span class="codefrag">IndexWriter</span> to store information in the index. In addition to the
+<a href="api/core/org/apache/lucene/store/FSDirectory.html">FSDirectory</a> implementation we are using,
+there are several other <span class="codefrag">Directory</span> subclasses that can write to RAM, to databases, etc.
</p>
<p>
-The particular <a href="api/core/org/apache/lucene/analysis/Analyzer.html">Analyzer</a> we
-are using, <a href="api/core/org/apache/lucene/analysis/standard/StandardAnalyzer.html">StandardAnalyzer</a>, is
-little more than a standard Java Tokenizer, converting all strings to lowercase and filtering out
-stop words and characters from the index. By stop words and characters I mean common language
-words such as articles (a, an, the, etc.) and other strings that may have less value for searching
-(e.g. <b>'s</b>) . It should be noted that there are different rules for every language, and you
-should use the proper analyzer for each. Lucene currently provides Analyzers for a number of
-different languages (see the <span class="codefrag">*Analyzer.java</span> sources under <a href="http://svn.apache.org/repos/asf/lucene/dev/trunk/modules/analysis/common/src/java/org/apache/lucene/analysis/">modules/analysis/common/src/java/org/apache/lucene/analysis</a>).
+Lucene <a href="api/core/org/apache/lucene/analysis/Analyzer.html">Analyzer</a>s are processing pipelines
+that break up text into indexed tokens, a.k.a. terms, and optionally perform other operations on these
+tokens, e.g. downcasing, synonym insertion, filtering out unwanted tokens, etc. The <span class="codefrag">Analyzer</span>
+we are using is <span class="codefrag">StandardAnalyzer</span>, which creates tokens using the Word Break rules from the
+Unicode Text Segmentation algorithm specified in <a href="http://unicode.org/reports/tr29/">Unicode
+Standard Annex #29</a>; converts tokens to lowercase; and then filters out stopwords. Stopwords are
+common language words such as articles (a, an, the, etc.) and other tokens that may have less value for
+searching. It should be noted that there are different rules for every language, and you should use the
+proper analyzer for each. Lucene currently provides Analyzers for a number of different languages (see
+the javadocs under
+<a href="api/module-analysis-common/org/apache/lucene/analysis/package-summary.html">modules/analysis/common/src/java/org/apache/lucene/analysis</a>).
</p>
<p>
-Looking further down in the file, you should see the <span class="codefrag">indexDocs()</span> code. This recursive
-function simply crawls the directories and uses <a href="api/demo/org/apache/lucene/demo/FileDocument.html">FileDocument</a> to create <a href="api/core/org/apache/lucene/document/Document.html">Document</a> objects. The <a href="api/core/org/apache/lucene/document/Document.html">Document</a> is simply a data object to
-represent the content in the file as well as its creation time and location. These instances are
-added to the <span class="codefrag">indexWriter</span>. Take a look inside <a href="api/demo/org/apache/lucene/demo/FileDocument.html">FileDocument</a>. It's not particularly
-complicated. It just adds fields to the <a href="api/core/org/apache/lucene/document/Document.html">Document</a>.
+The <span class="codefrag">IndexWriterConfig</span> instance holds all configuration for <span class="codefrag">IndexWriter</span>. For
+example, we set the <span class="codefrag">OpenMode</span> to use here based on the value of the <span class="codefrag">-update</span>
+command-line parameter.
</p>
<p>
-As you can see there isn't much to creating an index. The devil is in the details. You may also
-wish to examine the other samples in this directory, particularly the <a href="api/demo/org/apache/lucene/demo/IndexHTML.html">IndexHTML</a> class. It is a bit more
-complex but builds upon this example.
+Looking further down in the file, after <span class="codefrag">IndexWriter</span> is instantiated, you should see the
+<span class="codefrag">indexDocs()</span> code. This recursive function crawls the directories and creates
+<a href="api/core/org/apache/lucene/document/Document.html">Document</a> objects. The
+<span class="codefrag">Document</span> is simply a data object to represent the text content from the file as well as
+its creation time and location. These instances are added to the <span class="codefrag">IndexWriter</span>. If
+the <span class="codefrag">-update</span> command-line parameter is given, the <span class="codefrag">IndexWriter</span>
+<span class="codefrag">OpenMode</span> will be set to <span class="codefrag">OpenMode.CREATE_OR_APPEND</span>, and rather than
+adding documents to the index, the <span class="codefrag">IndexWriter</span> will <strong>update</strong> them
+in the index by attempting to find an already-indexed document with the same identifier (in our
+case, the file path serves as the identifier); deleting it from the index if it exists; and then
+adding the new document to the index.
</p>
</div>
-<a name="N100A0"></a><a name="Searching Files"></a>
+<a name="N100DB"></a><a name="Searching Files"></a>
<h2 class="boxed">Searching Files</h2>
<div class="section">
<p>
-The <a href="api/demo/org/apache/lucene/demo/SearchFiles.html">SearchFiles</a> class is
-quite simple. It primarily collaborates with an <a href="api/core/org/apache/lucene/search/IndexSearcher.html">IndexSearcher</a>, <a href="api/core/org/apache/lucene/analysis/standard/StandardAnalyzer.html">StandardAnalyzer</a>
-(which is used in the <a href="api/core/org/apache/lucene/demo/IndexFiles.html">IndexFiles</a> class as well) and a
-<a href="api/core/org/apache/lucene/queryParser/QueryParser.html">QueryParser</a>. The
+The <a href="api/contrib-demo/org/apache/lucene/demo/SearchFiles.html">SearchFiles</a> class is
+quite simple. It primarily collaborates with an
+<a href="api/core/org/apache/lucene/search/IndexSearcher.html">IndexSearcher</a>,
+<a href="api/modules-analysis-common/org/apache/lucene/analysis/standard/StandardAnalyzer.html">StandardAnalyzer</a> (which is used in the
+<a href="api/contrib-demo/org/apache/lucene/demo/IndexFiles.html">IndexFiles</a> class as well)
+and a <a href="api/core/org/apache/lucene/queryParser/QueryParser.html">QueryParser</a>. The
query parser is constructed with an analyzer used to interpret your query text in the same way the
-documents are interpreted: finding the end of words and removing useless words like 'a', 'an' and
-'the'. The <a href="api/core/org/apache/lucene/search/Query.html">Query</a> object contains
-the results from the <a href="api/core/org/apache/lucene/queryParser/QueryParser.html">QueryParser</a> which is passed to
-the searcher. Note that it's also possible to programmatically construct a rich <a href="api/core/org/apache/lucene/search/Query.html">Query</a> object without using the query
+documents are interpreted: finding word boundaries, downcasing, and removing useless words like
+'a', 'an' and 'the'. The <a href="api/core/org/apache/lucene/search/Query.html">Query</a>
+object contains the results from the
+<a href="api/core/org/apache/lucene/queryParser/QueryParser.html">QueryParser</a> which is passed
+to the searcher. Note that it's also possible to programmatically construct a rich
+<a href="api/core/org/apache/lucene/search/Query.html">Query</a> object without using the query
parser. The query parser just enables decoding the <a href="queryparsersyntax.html">Lucene query
-syntax</a> into the corresponding <a href="api/core/org/apache/lucene/search/Query.html">Query</a> object. Search can be executed in
-two different ways:
-<ul>
-
-<li>Streaming: A <a href="api/core/org/apache/lucene/search/Collector.html">Collector</a> subclass
-simply prints out the document ID and score for each matching document.</li>
-
-<li>Paging: Using a <a href="api/core/org/apache/lucene/search/TopScoreDocCollector.html">TopScoreDocCollector</a>
- the search results are printed in pages, sorted by score (i. e. relevance).</li>
-
-</ul>
-
+syntax</a> into the corresponding <a href="api/core/org/apache/lucene/search/Query.html">Query</a>
+object.
</p>
-</div>
-
-
-<a name="N100E2"></a><a name="The Web example..."></a>
-<h2 class="boxed">The Web example...</h2>
-<div class="section">
<p>
-<a href="demo3.html">read on>>></a>
-
+<span class="codefrag">SearchFiles</span> uses the <span class="codefrag">IndexSearcher.search(query,n)</span> method that returns
+<a href="api/core/org/apache/lucene/search/TopDocs.html">TopDocs</a> with max <span class="codefrag">n</span> hits.
+The results are printed in pages, sorted by score (i.e. relevance).
</p>
</div>
-
</div>
<!--+
|end content