FileDocCategorySizeDatePackage
SingleFieldTestDb.javaAPI DocApache Lucene 1.91178Mon Feb 20 09:17:42 GMT 2006org.apache.lucene.queryParser.surround.query

SingleFieldTestDb

public class SingleFieldTestDb extends Object

Fields Summary
private Directory
db
private String[]
docs
private String
fieldName
Constructors Summary
public SingleFieldTestDb(String[] documents, String fName)

    try {
      db = new RAMDirectory();
      docs = documents;
      fieldName = fName;
      Analyzer analyzer = new WhitespaceAnalyzer();
      IndexWriter writer = new IndexWriter(db, analyzer, true);
      for (int j = 0; j < docs.length; j++) {
        Document d = new Document();
        d.add(new Field(fieldName, docs[j], Field.Store.NO, Field.Index.TOKENIZED));
        writer.addDocument(d);
      }
      writer.close();
    } catch (java.io.IOException ioe) {
      throw new Error(ioe);
    }
  
Methods Summary
org.apache.lucene.store.DirectorygetDb()

return db;
java.lang.String[]getDocs()

return docs;
java.lang.StringgetFieldname()

return fieldName;