Hi all,
I have a caching problem with the code below:
Code:
MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, new StandardAnalyzer());
org.apache.lucene.search.Query searchQuery = parser.parse(query);
org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery(searchQuery, Test.class);
List results=hibQuery.list();
It seems that what ever I do with the cache settings I always get old data for the result items returned from the above code. This is only a problem when I update content for an existing object. New objects and deleting objects work fine.
While I am not sure if the above query gets the data from the database or Lucene index, I have checked them both and they have been updated with the new content. However, the only way to get the new content from the above query is to restart the servlet container, so previous query must be cached in memory somehow.
Anyone have any ideas what I could try?
I have switched off both first and second level cache in the hibernate configuration, but no luck:(
I execute the following code after every object update, but again no luck flushing the cache :(
Code:
FullTextSession fullTextSession = Search.getFullTextSession(dp);
fullTextSession.flush();
fullTextSession.flushToIndexes();
fullTextSession.clear();
Hope someone is able to give me pointers on this.
Big thanks in advance :)
Olli