Hi,
I'm trying to implement a fulltext search for a content string in an entity. The user should differ between case sensitive and case insensitive search. So I implemented a Analyzer that do not lowercase the indexes. I annotated the content as
Code:
@Lob
@org.hibernate.search.annotations.Field(index = Index.TOKENIZED)
@Analyzer(impl = CustomAnalyzer.class)
private String content = "";
For searching I use a MultiFieldQueryParser and a lucene Query.
Code:
MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[] {"content" }, new CustomAnalyzer());
org.apache.lucene.search.Query ftq;
ftq = parser.parse("content: searchString");
entities = entityManager.createFullTextQuery(ftq, Entity.class).getResultList();
A search like this is always case sensitive. But can't be case insensitive.
Is there a way to do a case insensitive search in a case sensitive index? The hint from a lucene forum to create 2 indexes one case sensitive and one insensitive is not an option.
Thanks, Timo