English 中文(简体)
为什么不更新我的刚果铁路的弹性研究指数?
原标题:Why is the elasticsearch index not updating in my mongo rails app?

我在3.2米戈的铁路上使用轮胎,我有没有更新的弹性研究。 我将问题模式列入下文。

class Question

  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Paranoia

  field :question,  :type => String
  field :answer,    :type => Array
  field :tags,      :type => Array
  field :views,     :type => Integer, :default => 0

  include Tire::Model::Search
  include Tire::Model::Callbacks

  mapping do
    indexes :question,  :analyzer =>  snowball , :boost => 100
    indexes :tags,      :analyzer =>  keyword 
  end

end

我提出了新的问题,即:问问题=和;“什么日? ” :answer => “Monday” ;在我查询<编码>时没有出现。 问题.tire.search 。 较老的问题正在上升,但新问题似乎没有在指数中增加。

<>Update>

以下错误信息在记录中显示:

[2012-05-14 19:42:41,725][DEBUG][action.index             ] [Century, Turner] [questions][4], node[JKD6HjRKQuqgwuQyJTl1qA], [P], s[STARTED]: 
Failed to execute [index {[questions][question][4fb1a677e0f5754d2e000004], source[_id=4fb1a677e0f5754d2e000004&answer[]=Monday&created_at=2012-05-14%2019%3A42%3A31%20-0500&deleted_at=&question=What%20day%20is%20it%3F&tags=&updated_at=2012-05-14%2019%3A42%3A31%20-0500&views=0]}]
org.elasticsearch.ElasticSearchParseException: Failed to derive xcontent from (offset=0, length=193): [95, 105, 100, 61, 52, 102, 98, 49, 97, 54, 55, 55, 101, 48, 102, 53, 55, 53, 52, 100, 50, 101, 48, 48, 48, 48, 48, 52, 38, 97, 110, 115, 119, 101, 114, 91, 93, 61, 77, 111, 110, 100, 97, 121, 38, 99, 114, 101, 97, 116, 101, 100, 95, 97, 116, 61, 50, 48, 49, 50, 45, 48, 53, 45, 49, 52, 37, 50, 48, 49, 57, 37, 51, 65, 52, 50, 37, 51, 65, 51, 49, 37, 50, 48, 45, 48, 53, 48, 48, 38, 100, 101, 108, 101, 116, 101, 100, 95, 97, 116, 61, 38, 113, 117, 101, 115, 116, 105, 111, 110, 61, 87, 104, 97, 116, 37, 50, 48, 100, 97, 121, 37, 50, 48, 105, 115, 37, 50, 48, 105, 116, 37, 51, 70, 38, 116, 97, 103, 115, 61, 38, 117, 112, 100, 97, 116, 101, 100, 95, 97, 116, 61, 50, 48, 49, 50, 45, 48, 53, 45, 49, 52, 37, 50, 48, 49, 57, 37, 51, 65, 52, 50, 37, 51, 65, 51, 49, 37, 50, 48, 45, 48, 53, 48, 48, 38, 118, 105, 101, 119, 115, 61, 48]
  at org.elasticsearch.common.xcontent.XContentFactory.xContent(XContentFactory.java:147)
  at org.elasticsearch.common.xcontent.XContentHelper.createParser(XContentHelper.java:49)
  at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:431)
  at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:417)
  at org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:311)
  at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:202)
  at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:529)
  at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:427)
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
  at java.lang.Thread.run(Thread.java:680)
问题回答

页: 1

class Article
  include Mongoid::Document
  field :title, :type => String
  field :content, :type => String

  include Tire::Model::Search
  include Tire::Model::Callbacks

  # These Mongo guys sure do get funky with their IDs in +serializable_hash+, let s fix it.
  #
  def to_indexed_json
    self.to_json
  end

end




相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签