sunspot

How do I capture a rsolr Sunspot exception raised on a different thread from a model callback?

99封情书 提交于 2019-12-11 02:59:28
问题 Even though I can capture the exception raised from @post.save and log the error and print the threads begin if @post.save rescue Exception => ex # rescue Errno::ECONNREFUSED => ex Thread.list.each {|t| p t} Rails.logger.error "ERROR: Could not save blog post! Is the Solr server up and running? Exception: #{ex}" it still errors out on the web page and doesn't show any of my code in the stack trace. The solr Sunspot model callback is running on a separate thread. rsolr (1.0.9) lib/rsolr

Solr, Sunspot, SQlite, and Rails

爷,独闯天下 提交于 2019-12-10 19:54:20
问题 I would like to implement a full text search + faceting for my project that uses SQlite3 as the database. I heard that Solr is really powerful. There are Sunspot & Solr tutorials available but only for MySQL. I can't find any document for how to set it up for SQLite3. Anyone know how to set it up with SQLite3? Or is it not possible? 回答1: It should be exactly the same... AFAIK Solr doesn't work with database directly but rather provides REST API to store, index and search documents. 来源: https:

What part of this Solr-Sunspot setup am I missing?

混江龙づ霸主 提交于 2019-12-10 19:36:23
问题 I thought I had this down piece-of-cake .. but anytime I do a query on any keyword it doesn't load any tables from SQL. I get no errors. user.rb searchable do string :first_name string :last_name string :name string :email time :created_at end users_controller.rb class Admin::UsersController < Admin::ApplicationController def index s = Sunspot.search User do |query| query.keywords params[:q] query.any_of do |any_of| any_of.with(:first_name) any_of.with(:first_name) any_of.with(:email) any_of

Rails Sunspot/Solr: Ordering on multiple-value field

牧云@^-^@ 提交于 2019-12-10 17:16:02
问题 I'm trying to do a priority "order by" on a multiple-value field using solr - any idea how I can accomplish the below? searchable do integer :skill_ids, :multiple => true end def self.filter_using_solr(opts={}) Sunspot.search(JobApplication) do |s| opts[:order_skill_ids].each do |skill_id| s.order_by(:skill_ids, skill_id) end end end end I get the following exception "skill_ids cannot be used for ordering because it is a multiple-value field" - but not sure on the alternate path. 回答1: Perhaps

How to avoid retrieve entire stored field from solr

半世苍凉 提交于 2019-12-10 10:57:01
问题 I'm using sunspot and solr for a rails app to search ebook contens, for highlight feature I have to set the ebook_content as a stored filed, every time I queried solr for result, it sends back the entire document content about the book, which makes the query very slow. How could I only get the result without the stored field? 回答1: The fl parameter of Solr allows you to specify which fields you want returned in the result. If you had fields id, title, ebook_content , then you could use fl=id

solr, sunspot, bad request, illegal character

别说谁变了你拦得住时间么 提交于 2019-12-10 09:27:52
问题 I am introducing sunspot search into my project. I got a POC by just searching by the name field. When I introduced the description field and reindexed sold I get the following error. ** Invoke sunspot:reindex (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute sunspot:reindex Skipping progress bar: for progress reporting, add gem 'progress_bar' to your Gemfile rake aborted! RSolr::Error::Http: RSolr::Error::Http - 400 Bad Request Error: {'responseHeader'=>{

RSolr::Error::InvalidRubyResponse - 200 OK

别来无恙 提交于 2019-12-10 03:24:36
问题 I am getting following error even after starting forreman and starting sunspot:solr : RSolr::Error::InvalidRubyResponse - 200 OK Error: <result status="1">java.lang.NullPointerException at org.apache.solr.handler.XmlUpdateRequestHandler.doLegacyUpdate(XmlUpdateRequestHandler.java:129) at org.apache.solr.servlet.SolrUpdateServlet.doPost(SolrUpdateServlet.java:87) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at

400 Bad Request: unknown field 'type'

自闭症网瘾萝莉.ら 提交于 2019-12-09 11:43:04
问题 I've set up Solr 3.6.2 on Tomcat as described here. Using the sunspot-rails gem and the embedded solr server I have no problems, but on my staging server I'm getting the response: message ERROR: [doc=Foo 20] unknown field 'type' description The request sent by the client was syntactically incorrect. The request data looks like this: <?xml version="1.0" encoding="UTF-8"?> <add> <doc> <field name="id">Foo 20</field> <field name="type">Foo</field> <field name="type">ActiveRecord::Base</field>

Searching across multiple models using sunspot/solr

半腔热情 提交于 2019-12-09 06:59:33
问题 I have been able to implement a basic full text search successfully, however any queries involving models from many to many relations don't seem to work for me when i try to use scopes ("with statements"). I know the relevant rows are in the db as my sql statements do return the data. however the sunspot queries don't return any results…i'm sure its probably a newbie goof up on my end…any assistance would be greatly appreciated…so here we go…. My Models class User has_one :registration

How to use sunspot_rails gem to search for related articles

徘徊边缘 提交于 2019-12-09 02:21:53
问题 I have a mini blog app and i would like user to view articles that relates to what they are reading in the article show page. without the sunspot_rails gem i would do something like this in my model def self.related_search(query, join = "AND") find(:all, :conditions => related_search_conditions(query, join)) end def self.related_search_conditions(query, join) query.split(/\s+/).map do |word| '(' + %w[name description notes].map { |col| "#{col} LIKE #{sanitize('%' + word.to_s + '%')}" }.join('