tire

Config Tire to work with Bonsai ElasticSearch Heroku add-on

北城余情 提交于 2019-12-11 23:28:36
问题 So I have a rails 3.2 app. I created an index. I followed this guide: https://gist.github.com/nz/2041121 to create an bonsai.rb file in config/initializers/bonsai.rb It looks like this: ENV['ELASTICSEARCH_URL'] = ENV['BONSAI_URL'] # Optional, but recommended: use a single index per application per environment. # Caveat: This convention not be entirely supported throughout Tire's API. app_name = Rails.application.class.parent_name.underscore.dasherize app_env = Rails.env INDEX_NAME = "#{app

elasticsearch stops indexing new documents after a while, using Tire

回眸只為那壹抹淺笑 提交于 2019-12-11 15:03:49
问题 I have my website running, with ElasticSearch, using Tire. In the background, I have a rake task that is looping over thousands of objects and creating one record for each of them. At first, the records are indexed, and every time I refresh my website, I can see the number of records found go up. But at some point, it just stops. It saves the records to mysql, but does not index them anymore. Note that the site and the search are still up and running. Why is that? Is there some kind of lock

fields not in mapping are included in the search results returned by ElasticSearch

 ̄綄美尐妖づ 提交于 2019-12-11 03:38:29
问题 I want to index pdf attachment using Tire gem as client for ElasticSearch. In my mapping, I exclude the attachment field from _source, so that the attachment is not stored in the index and not returned in the search results : mapping :_source => { :excludes => ['attachment_original'] } do indexes :id, :type => 'integer' indexes :folder_id, :type => 'integer' indexes :attachment_file_name indexes :attachment_updated_at, :type => 'date' indexes :attachment_original, :type => 'attachment' end I

i18n search using tire and Globalize3

这一生的挚爱 提交于 2019-12-11 03:36:42
问题 i have a site that uses globalize3 gem (https://github.com/svenfuchs/globalize3) and i'm currently adding the Tire gem to make site search. How do i do to Index a table translations depending on the actual locale? right now the model that gets indexed only does with the default locale. 回答1: You'd have to index all the translations: class Centre < ActiveRecord::Base include Tire::Model::Search include Tire::Model::Callbacks mapping do indexes :title_en, :as => lambda { |post| I18n.locale = :en

Update elasticsearch settings via Tire

亡梦爱人 提交于 2019-12-11 01:11:13
问题 Is it possible to use Tire to update elasticsearch settings? I have this curl command I'd like to run automatically. `curl -XPUT localhost:9200/tweets/_settings -d '{ "index" : { "refresh_interval" : "-1" } }'` The value is available via tire but I'm not sure how to apply it. Tweet.tire.settings[:refresh_interval] 回答1: Possible, but ugly :) Tire::Configuration.client.put([Tire::Configuration.url, Tweet.index.name].join('/'), index: { refresh_interval: '-1' }) Will get nicer in future versions

The new elasticsearch-ruby gem integrating with rails

≡放荡痞女 提交于 2019-12-10 16:34:04
问题 there is any way to integrate the new Elasticsearch gem for ruby to rails, the tire was great but retired since two month and replaced by the new gem, however, no integrating functions with rails yet. all the tutorial use tire, but now, how we can using rails with Elasticsearch? 回答1: There is another gem called "searchkick" that integrates elasticsearch with Rails: https://github.com/ankane/searchkick It has some really cool features and can index data through rake tasks. 回答2: A full-featured

Elastic Search/Tire: How to map to association attribute?

南笙酒味 提交于 2019-12-09 18:40:53
问题 I'm using Tire for Elastic Search. In my application I have 2 models; Price and Product. I'm trying to search my Price class and use the Product it belongs to's :name attribute for the search field. Right now if I had a product called Product 1 and type in "pro", "prod" or "duct", no results come up. But typing "product" or "Product" shows the results. I believe the problem lies in my mapping. I looked at the query and its: ...localhost:3000/search/results?utf8=%E2%9C%93&query=product When I

Facet Troubles with Elasticsearch on Query

好久不见. 提交于 2019-12-09 13:51:17
问题 When adding a term to my query instead of a filter I am getting 0 facets. FYI I am using the tire gem with Ruby. Here is my model code with its mapping: class Property < ActiveRecord::Base include Tire::Model::Search include Tire::Model::Callbacks has_and_belongs_to_many :tags mapping do indexes :id, type: 'integer' indexes :status indexes :refno, type: 'integer' indexes :name, :analyzer => 'snowball', :boost => 100 indexes :description indexes :tags, type: 'object', properties: { name: {

tire terms filter not working

假如想象 提交于 2019-12-08 19:20:32
I'm trying to achieve a "scope-like" function with tire/elasticsearch. Why is this not working, even when i have entries with status "Test1" or "Test2"? The results are always empty. collection = @model.search(:page => page, :per_page => per_page) do |s| s.query {all} s.filter :terms, :status => ["Test1", "Test2"] s.sort {by :"#{column}", "#{direction}"} end The method works fine without the filter. Is something wrong with the filter method?! I've checked the tire doku....it should work. Thanks! :) Your issue is most probably being caused by using the default mappings for the status field,

tire terms filter not working

余生颓废 提交于 2019-12-08 07:59:54
问题 I'm trying to achieve a "scope-like" function with tire/elasticsearch. Why is this not working, even when i have entries with status "Test1" or "Test2"? The results are always empty. collection = @model.search(:page => page, :per_page => per_page) do |s| s.query {all} s.filter :terms, :status => ["Test1", "Test2"] s.sort {by :"#{column}", "#{direction}"} end The method works fine without the filter. Is something wrong with the filter method?! I've checked the tire doku....it should work.