import org.egothor.dir.TankerImpl;
import org.egothor.parser.Tokenizer;
import org.egothor.data.*;
import org.egothor.parser.plain.Plain;
import org.egothor.parser.misc.*;
import java.io.StringReader;
public class Sample {
public static void main(String[] args) throws Exception {
TankerImpl index = new TankerImpl("index/",false,32,10);
FTField field = new MyTxtField("This is my document");
DocMetadata dm = new DocMetadata();
dm.put("S","Some summary...");
dm.put("L","Location of this doc is on my HDD...");
dm.put("T","Title of the document...");
Document doc = new Document(dm, field);
index.append(doc);
index.close();
}
}
class MyTxtField extends FTField {
String text;
MyTxtField(String text) { this.text = text; }
public Tokenizer words() {
return
new LowerCase( new Plain( new StringReader(text) ) );
}
}
See: SearchingAPI
-- LeoGalambos - 15 Mar 2004