I am running some TestNG tests to make sure my JPA search works correctly. As a precondition I manually generate indexes in this way:
Code:
fullTextEntityManager = org.hibernate.search.jpa.Search.createFullTextEntityManager(em);
List searchables = em.createQuery("from Customer as customer").getResultList();
for (Object obj : searchables) {
fullTextEntityManager.index(obj);
}
And the indexes are generated in the right place defined in persistence.xml.
Then when I run my tests I find at this code:
Code:
fullTextQuery = em.createFullTextQuery(query, Customer.class);
totalResultCount = fullTextQuery.getResultSize();
that the totalResultCount = 0 even when I put in a literal term (no fuzzy or anything fancy) that corresponds identically with what's in the database like
name:John. I generate the query using the Lucene API.
That by itself could be anything, but what is weird is that the same query, which I obtain from my logs,
does in fact generate results when I run it using Luke against the same indexes with the same analyzer (StandardAnalyzer).
I could supply code, but I thought I would ask first if there are any obvious things to check in cases like this.
This has frustrated me for a day now, so any insight is appreicated.
Thanks.