Skip to content
This repository has been archived by the owner on Jun 30, 2018. It is now read-only.

Result decorator #368

Closed
wants to merge 7 commits into from
Closed

Conversation

martinciu
Copy link
Contributor

Hi,

As I described in #364 I needed a way to merge attributes returned by ElasticSearch with model loaded from database. I needed to get merge them with values returned from scritp_fields (see #363).

So now search results returns array of Results::Item whenever you get load models for results or not and passes missing methods first to attributes array and than to loaded model.

@karmi
Copy link
Owner

karmi commented Jul 26, 2012

@martinciu Hi, I like the refactoring you did, sorry it took me so long to get to it.

I'm not sure about returning Item instances when using the :load option, though. I think we should have something like Sunspot's each_with_hit (see #406 and #261).

I'll try to have a look into this shortly.

@martinciu
Copy link
Contributor Author

Hi @karmi I'll take a look at Sunspot's each_with_hit

thanks!

@karmi
Copy link
Owner

karmi commented Oct 23, 2012

@martinciu What do you think about the each_with_hit approach? I think it would be better then to decorate the results directly? Also notice the refactoring I did in https://github.com/karmi/tire/tree/refactoring/results to better support people needing to change the code which loads data from the database...

@karmi
Copy link
Owner

karmi commented Oct 26, 2012

Closing in favour of each_with_hit (or similar) feature.

@karmi karmi closed this Oct 26, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants