How to configure lucene + hibernate and develop wildcard query which matches some field by any exact part of that field value? For instance if we have some field "title" indexed and only two entries for it: "My first wildcard query." and "My second wildcard query."; then if we query for "irsT WiLdCaRd q" then it has to return only first one. Also it doesn't has to be case sensitive.
I've tried something like this:
FullTextSession ftSession = org.hibernate.search.Search.getFullTextSession((Session) em.getDelegate());
QueryContextBuilder qbc = ftSession.getSearchFactory().buildQueryBuilder();
EntityContext entityContext = qbc.forEntity(Book.class);
QueryBuilder qb = entityContext.get();
org.apache.lucene.search.Query q = qb.keyword().wildcard().onField("title")
.ignoreAnalyzer().matching("*" + QueryParser.escape("irsT WiLdCaRd q").toLowerCase() + "*").createQuery();
FullTextEntityManager ftEm = org.hibernate.search.jpa.Search.getFullTextEntityManager(em);
final FullTextQuery ftq = ftEm.createFullTextQuery(q, Book.class);
List list = ftq.getResultList();
and it doesn't work, because it's keyword oriented and there's no analog with wildcard for phrase. Using direct WildcardQuery also doesn't work(