Where does lucene .net cache the search results?
Posted
by Lanceomagnifico
on Stack Overflow
See other posts from Stack Overflow
or by Lanceomagnifico
Published on 2009-03-27T15:53:32Z
Indexed on
2010/03/21
12:01 UTC
Read the original article
Hit count: 717
Hi,
I'm trying to figure out where Lucene stores the cached query results, and how it's configured to do so - and how long it caches for.
This is for an ASP.NET 3.5 solution.
I'm getting this problem:
If I run a search and sort the result by a particular product field, it seems to work the very first time each search and sort combination is used. If I then go in and change some product attributes, reindex and run the same search and sort, I get the products returned in the same order as the very first result.
example
Product A is named: foo
Product B is named: bar
For the first search, sort by name desc. This results in:
- Product A
- Product B
Now mix up the data a bit:
- Change names to:
Product A named: bar
Product B named: foo - reindex
- verify that the index contains the changes for these two products.
- search
Result:
- Product A
- Product B
Since I changed the alphabetical order of the names, I expected:
- Product B
- Product A
So I think that Lucene is caching the search results. (Which, btw, is a very good thing.) I just need to know where/how to clear these results. I've tried deleting the index files and doing an IISreset to clear the memory, but it seems to have no effect. So I'm thinking there is another set of Lucene files outside of the indexes that Lucene uses for caching.
EDIT
I just found out that you must create the index for field you wish to sort on as un-tokenized. I had the field as tokenized, so sorting didn't work.
© Stack Overflow or respective owner