Open anishshah1210 opened 10 years ago
I remember the CLASS='Article.all'
trick somebody's been using with Mongo, but not the details. Try it with the regular CLASS=Article
argument.
i already tried with rake environment tire:import CLASS='Article.all' rake environment tire:import all rake environment tire:import CLASS='Article' but error remains same
when run rake environment tire:import CLASS='Article' gives undefined method `paginate' for Article:Class
You're using quite an old version of Tire. Please upgrade and try again.
Also, there's new integration for ActiveModel+Rails at https://github.com/elasticsearch/elasticsearch-rails, I strongly recommend to use it instead of Tire.
I have already tried different version of tire gem like 0.6.0,0.6.2 and 0.5.1
can you please suggest me the probable cause of error because I am middle of my development and this doesn't seems feasible idea to move tire gem to something else
I'm afraid I can't -- you're running an old version of a retired library, you don't send any information what and how exactly you include
Tire modules, ...
Try generating the example application (see README), try playing with the included integration tests for Mongo.
i tried the example app. rails new searchapp -m https://raw.github.com/karmi/tire/master/examples/rails-application-template.rb and put my model code inside but import gives me the same error .. feel very sad!
my article.rb MIN_TERM_CHARS = 2 MAX_NGRAM_CHARS = 20
include SyncAttr include Tire::Model::Persistence
settings \ analysis: { analyzer: { "default" => { "type" => "custom", "tokenizer" => "standard", "filter" => ["standard", "asciifolding", "lowercase", "munk_length", "munk_decompounder", "munk_stop", "munk_synonym"] }, "ngram_index_analyzer" => { "type" => "custom", "tokenizer" => "standard", "filter" => ["standard", "asciifolding", "lowercase", "munk_length", "munk_decompounder", "munk_stop", "munk_synonym", "ngram_filter"] }, "ngram_search_analyzer" => { "type" => "custom", "tokenizer" => "standard", "filter" => ["standard", "asciifolding", "lowercase", "munk_length", "munk_decompounder", "munk_stop", "munk_synonym"] }, "hierarchie_index_analyzer" => { "type" => "custom", "tokenizer" => "hierarchie_tokenizer" }, "suggest_analyzer" => { "type" => "custom", "tokenizer" => "standard",
# though because of inconsistent writing in article data as well as query strings.
# if we add stopwords then we probably want to set "enable_position_increments": "false".
# see http://getelastomer.com/blog/2013/01/searching-with-shingles/#.URAThFrjmoo
#
"filter" => ["standard", "lowercase", "suggest_shingle"]
}
},
tokenizer: {
"hierarchie_tokenizer" => {
"type" => "path_hierarchy",
"delimiter" => "|",
}
},
filter: {
"munk_decompounder" => {
"type" => "dictionary_decompounder",
"word_list_path" => Rails.root.join("config", "es", "munk_compound_words.txt").to_s,
},
"munk_stop" => {
"type" => "stop",
"stopwords_path" => Rails.root.join("config", "es", "munk_stop_words.txt").to_s,
},
"munk_synonym" => {
"type" => "synonym",
"synonyms_path" => Rails.root.join("config", "es", "munk_synonym_words.txt").to_s,
"expand" => true # we want to expand terms because of compound words
},
"munk_length" => {
"type" => "length",
"min" => MIN_TERM_CHARS, # require at least 2 chars. 2 is better than 3 here because of abbreviations.
},
"ngram_filter" => {
"type" => "nGram",
"min_gram" => MIN_TERM_CHARS, # start ngrams with 3 chars. 2 chars are expensive and not neccessary
"max_gram" => MAX_NGRAM_CHARS # TODO: longest search word?
},
"suggest_shingle" => {
"type" => "shingle",
"min_shingle_size" => 2,
"max_shingle_size" => 3
}
}
}
index_name { Thread.current[:index_name] || "test" } document_type "document"
property :artikelnummer, type: 'string', index: 'not_analyzed' property :eannummer, type: 'string', index: 'not_analyzed'
property :bezeichnung, type: 'multi_field', fields: { bezeichnung: {type: 'string'}, ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'}, suggest: {:type => 'string', :analyzer => 'suggest_analyzer'} }
property :bezeichnung_zusatz, type: 'multi_field', fields: { bezeichnung_zusatz: {type: 'string'}, ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'} }
property :matchcode, type: 'string', index: 'not_analyzed'
property :mengeneinheit, type: 'string', include_in_all: false
property :gewicht, type: 'float', include_in_all: false
property :hersteller, type: 'multi_field', fields: { hersteller: {type: 'string'}, unchanged: {type: 'string', :index => 'not_analyzed'}, ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'} }
property :hersteller_nummer, type: 'string', index: 'not_analyzed', include_in_all: false
property :hersteller_artikelnummer, type: 'string', index: 'not_analyzed'
property :gruppe, type: 'multi_field', fields: { gruppe: {type: 'string'}, ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'} }
property :gruppe_zusatz, type: 'multi_field', fields: { gruppe_zusatz: {type: 'string'}, ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'} }
property :gruppe_nummer, type: 'string', index: 'not_analyzed', include_in_all: false
property :hierarchie, type: 'multi_field', fields: { hierarchie: {type: 'string', index_analyzer: 'hierarchie_index_analyzer', search_analyzer: 'keyword', include_in_all: false}, ngram: {type: 'string', index_analyzer: 'ngram_index_analyzer', search_analyzer: 'ngram_search_analyzer'} }
property :langtext, type: 'multi_field', fields: { langtext: {type: 'string'}, ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'} }
property :infotext, type: 'multi_field', fields: { infotext: {type: 'string'}, ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'} }
property :bestelltext, type: 'multi_field', fields: { bestelltext: {type: 'string'}, ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'} }
property :dimension, type: 'string', include_in_all: false
property :listenpreis_netto, type: 'float', index: 'not_analyzed', include_in_all: false
property :listenpreis_brutto, type: 'float', index: 'not_analyzed', include_in_all: false
validates_presence_of :artikelnummer validates_presence_of :bezeichnung
def self.set_current_index_name(name) Thread.current[:index_name] = name end
when I run this command rake environment tire:import CLASS=Article FORCE=true i got error [IMPORT] Importing 'Article' rake aborted! undefined method `paginate' for Article:Class
when i run rake environment tire:import CLASS='Article.all' INDEX='mongo-articles' FORCE=true
gives error * Invoke environment (first_time) * Execute environment * Invoke tire:import (first_time) * Execute tire:import [IMPORT] Deleting index 'mongo-articles' rake aborted! undefined method
tire' for #<Tire::Results::Collection:0xabec954> /home/helios/.rvm/gems/ruby-1.9.3-p484@munksearch/gems/tire-0.5.1/lib /tire/tasks.rb:55:in
block (2 levels) in <top (required)>' Tasks: TOP => tire:import I have already tried different version of tire gem like 0.6.0,0.6.2 and 0.5.1i am completely struck from here