mirror of https://github.com/apache/lucene.git
Add basic javadoc to demo classes.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@381422 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bdaee8f24e
commit
b1fef86a4a
|
@ -22,8 +22,13 @@ import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
//import org.apache.lucene.index.Term;
|
//import org.apache.lucene.index.Term;
|
||||||
|
|
||||||
class DeleteFiles {
|
|
||||||
|
/** Deletes documents from an index that do not contain a term. */
|
||||||
|
public class DeleteFiles {
|
||||||
|
|
||||||
|
private DeleteFiles() {} // singleton
|
||||||
|
|
||||||
|
/** Deletes documents from an index that do not contain a term. */
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String usage = "java org.apache.lucene.demo.DeleteFiles <unique_term>";
|
String usage = "java org.apache.lucene.demo.DeleteFiles <unique_term>";
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
|
|
|
@ -24,10 +24,14 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
class IndexFiles {
|
/** Index all text files under a directory. */
|
||||||
|
public class IndexFiles {
|
||||||
|
|
||||||
|
private IndexFiles() {}
|
||||||
|
|
||||||
static final File INDEX_DIR = new File("index");
|
static final File INDEX_DIR = new File("index");
|
||||||
|
|
||||||
|
/** Index all text files under a directory. */
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String usage = "java org.apache.lucene.demo.IndexFiles <root_directory>";
|
String usage = "java org.apache.lucene.demo.IndexFiles <root_directory>";
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
|
@ -64,7 +68,7 @@ class IndexFiles {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void indexDocs(IndexWriter writer, File file)
|
static void indexDocs(IndexWriter writer, File file)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
// do not try to index files that cannot be read
|
// do not try to index files that cannot be read
|
||||||
if (file.canRead()) {
|
if (file.canRead()) {
|
||||||
|
|
|
@ -26,13 +26,16 @@ import java.io.File;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
class IndexHTML {
|
/** Indexer for HTML files. */
|
||||||
|
public class IndexHTML {
|
||||||
|
private IndexHTML() {}
|
||||||
|
|
||||||
private static boolean deleting = false; // true during deletion pass
|
private static boolean deleting = false; // true during deletion pass
|
||||||
private static IndexReader reader; // existing index
|
private static IndexReader reader; // existing index
|
||||||
private static IndexWriter writer; // new index being built
|
private static IndexWriter writer; // new index being built
|
||||||
private static TermEnum uidIter; // document id iterator
|
private static TermEnum uidIter; // document id iterator
|
||||||
|
|
||||||
|
/** Indexer for HTML files.*/
|
||||||
public static void main(String[] argv) {
|
public static void main(String[] argv) {
|
||||||
try {
|
try {
|
||||||
String index = "index";
|
String index = "index";
|
||||||
|
|
|
@ -33,7 +33,8 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.Hits;
|
import org.apache.lucene.search.Hits;
|
||||||
import org.apache.lucene.queryParser.QueryParser;
|
import org.apache.lucene.queryParser.QueryParser;
|
||||||
|
|
||||||
class SearchFiles {
|
/** Simple command-line based search demo. */
|
||||||
|
public class SearchFiles {
|
||||||
|
|
||||||
/** Use the norms from one field for all fields. Norms are read into memory,
|
/** Use the norms from one field for all fields. Norms are read into memory,
|
||||||
* using a byte of memory per document per searched field. This can cause
|
* using a byte of memory per document per searched field. This can cause
|
||||||
|
@ -53,6 +54,9 @@ class SearchFiles {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SearchFiles() {}
|
||||||
|
|
||||||
|
/** Simple command-line based search demo. */
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
String usage =
|
String usage =
|
||||||
"Usage: java org.apache.lucene.demo.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-raw] [-norms field]";
|
"Usage: java org.apache.lucene.demo.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-raw] [-norms field]";
|
||||||
|
|
Loading…
Reference in New Issue