SearcherFactory searcherFactory = new SimpleSearcherFactory(directory);
//Initialization of the query
LuceneSearchQuery query=new ParsedLuceneSearchQuery(searcherFactory,new SimpleAnalyzer()) {
protected QueryParams configureSearchQuery(String textToSearch) {
return new QueryParams("field", textToSearch);
}
protected Object extractResultHit(int id, Document document, float score) {
return document.get("field");
}