SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-665
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Shay Banon
Reporter: Alex Burgel
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Compass

MultiReaders should be cached by Compass

Created: 26/Jun/08 02:35 PM   Updated: 09/Jul/08 03:58 PM
Component/s: Compass::Core
Affects Version/s: 2.0.1
Fix Version/s: 2.0.2, 2.1.0 M2


 Description  « Hide
See: http://forum.compass-project.org/thread.jspa?threadID=215502&tstart=0

Lucene's FieldCache uses an IndexReader as the key. Since Compass creates a new MultiReader for each transaction, the FieldCache becomes useless, slowing down sorted queries.

One solution is to cache MultiReaders. Another would be to implement equals and hashCode on the MultiReader that is based on the IndexReaders that it contains. That would allow new instances of MultiReaders to be created. I don't know the internals of Lucene well enough to know if this is safe, but it might be worth looking into, since it would be much easier to implement.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Alex Burgel added a comment - 30/Jun/08 09:49 AM
Ignore that last solution. FieldCacheImpl in lucene uses a WeakHashMap as its cache, so implementing hashCode and equals on MultiReaders won't work. You have to hold on to each instance of MultiReader.

Shay Banon added a comment - 09/Jul/08 03:58 PM
Fixed the way searcher is constructed. Using multi searcher instead of multi reader with a single searcher. Will make searches a tad slower, but won't hurt the field cache.