Can you try this:
Code:
@Entity
@Table(name = "QUESTION")
@Analyzer(impl = StandardAnalyzer.class)
@Indexed
public class Question {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "QUESTION_ID")
@DocumentId
private Long id;
@Column(name = "QUESTION_TEXT")
@Field(name = "questiontext", store = Store.YES, index = Index.TOKENIZED)
private String questionText;
...getters and setters
}
for searching i used hibernate
Code:
QueryParser parser = new QueryParser(Version.LUCENE_29, "questiontext", new StandardAnalyzer(Version.LUCENE_29));
org.apache.lucene.search.Query query = null;
try {
query = parser.parse(term);
} catch (Exception e) {
throw new IllegalStateException(e);
}
FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(query, Question.class);
org.hibernate.Query hibQuery = fullTextQuery;
return hibQuery.list();
I've tested the above and get results back.
Cheers
Amin