Hi Hardy,
thanks for helping!
Yes, of course, I use the same analyzer for indexing and searching. I tried the StandardAnalyzer and the simple analyzer, I don't want any stop words, word stemming is also not necessary, I only want ignore-case.
This is the annotation I used:
Code:
/**
* username for web frontend / updates
*/
@Column(unique = true)
@Field(index = Index.TOKENIZED, store = Store.NO)
private String username;
And this is the reindex code:
Code:
List<ProfileDto> result;
Query query = session.createQuery("from ProfileDto as ProfileDto");
query.setFirstResult(startIndex);
query.setMaxResults(REINDEX_PAGE_SIZE);
query.setCacheable(false);
query.setReadOnly(true);
result = query.list();
for (ProfileDto profile : result) {
profile.setMasterData(getUserDao().getByUid(profile.getUserId()));
fullTextSession.index(profile);
}
resultSize = result.size();
fullTextSession.flushToIndexes();
And this for querying:
Code:
FullTextQuery query = (FullTextQuery) fullTextSession.createFullTextQuery(parser.parse("masterData.username:" +searchParams.getUsername() + "*"), ProfileDto.class);
Sort sort = new Sort(new SortField("masterData.lastAccessTime", true));
query.setSort(sort);
query.setTimeout(getQueryTimeout());
if (size != null && offset != null) {
query.setFirstResult(offset);
query.setMaxResults(size);
}
List<ProfileDto> result = query.list();
Any idea what might be wrong?
Kind regards,
Ingo