Skip to content

Conversation

@jarib
Copy link
Contributor

@jarib jarib commented Jan 25, 2014

I think these options are meant to be passed on, not silently ignored.

I discovered this while trying to perform a multi-index search while retaining the niceities of the Response/Results/Result wrapping by doing something like this:

Foo.search({query: ...}, index: [Foo.index_name, Bar.index_name].join(','))

(more or less what I used Tire.search for before)

However since the options are not being passed on I'm unable to update the index field.

@karmi
Copy link
Contributor

karmi commented Jan 26, 2014

Definitely!, this looks more lie a typo.

Just a little caveat, will all the changed logic about how the library fetches records from the database, it's no longer possible to do all the tricks for multi-model searches as we did in Tire. On the other hand, that's a can of worms best left on a shelf.

@jarib
Copy link
Contributor Author

jarib commented Jan 26, 2014

Oh right, perhaps that isn't going to work too well anyway.

So is the recommended approach for searching multiple indices to use Elasticsearch::Model.client and just handle the response hash from yourself?

@karmi
Copy link
Contributor

karmi commented Jan 26, 2014

The MyModel.search().response.results will happily give you "hits" wrapped in Hashie::Mash, so it might be enough to use just that.

In case you want real records, I think you have to map and gather the [klass, ID] pairs, and query the database on your own.

I didn't gave "multi model searches" too much thought, at the current stage of the project, though, so it's possible there might be something to provide on the library level down the road...

jarib added a commit to holderdeord/hdo-site that referenced this pull request Jan 26, 2014
@karmi karmi closed this in 884de11 Jan 27, 2014
@karmi
Copy link
Contributor

karmi commented Jan 27, 2014

Thanks!, Jari, merged & pushed. If you bump into issues when migrating from Tire, ping me here or on IRC.

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