Skip to content

Conversation

@jamster
Copy link

@jamster jamster commented Jan 28, 2011

This optimization sets the query to pull ids only (:ids_only option in Rubberband) and then compacts the array and passes that into the find method. This makes for a single query rather than having one query for each hit returned. It also compacts and uniqifies the array.

@pfeiffer
Copy link

pfeiffer commented Feb 8, 2011

Cool!

This commit will raise an exception if ElasticSearch returned an ID that was deleted in the meantime, and doesn't fit well with the multi-model search. I dont find the :quick_search-option is the right way to go - but I agree that the performance hit on fetching each and every object is not worth it.

What I've implemented in my projects using Escargot is a layer between my application and Escargot. I only fetch the IDs via Escargot, and make sure only to fetch AR-models on the records I actually need in my application - eg. after paging/slicing has been done. This also allows options to the finder, eg. :include => [:image] to reduce N+1 queries.

Preferably something like this would be implemented in Escargot, as the current implementation isn't very optimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants