sunspot-rails

Reindex on sunspot rails

醉酒当歌 提交于 2019-12-11 12:55:04
问题 I have been trying to figure this out, but could not find the solution. Been trying all the suggestion from stackoverflow, but none works so far. I have setup the sunspot rails, and whenever i tried to reindex the database, its throwing me this error: rake sunspot:reindex Skipping progress bar: for progress reporting, add gem 'progress_bar' to your Gemfile rake aborted! RSolr::Error::Http: RSolr::Error::Http - 404 Not Found Error: NOT_FOUND URI: http://localhost:8982/solr/default/update?wt

Matching 2 out of 3 terms in Sunspot and WebSolr

笑着哭i 提交于 2019-12-11 07:57:25
问题 THe partial matching on my search is not working correctly. When I type in "Dublin Ireland" into my search then it correctly returns all the results in Dublin, Ireland. However, when I type "County Dublin Ireland" then it doesn't return any. I've set up an EdgeNGramFilter in my schmea.xml like so: <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="10"/> And I'm doing a fulltext search on the sunspot end on location: search_results = Events.solr_search do fulltext

Sorting the result - sunspot rails

本秂侑毒 提交于 2019-12-11 04:43:45
问题 I have two models, School model and Price model. Every school has a price. Right now I get back the result I want, but I like to implement a sorting function that sorts the highest price for a school and the lowest. School-controller: class SchoolsController < ApplicationController def index @query = params[:search] @search = School.search(:include => [:price] do fulltext params[:search] paginate :page => params[:page], :per_page => 7 end @results = @search.results end end School-model: class

How to setup Solr Cloud with two search servers?

别来无恙 提交于 2019-12-10 18:50:49
问题 Hi I'm developing rails project with sunspot solr and configuring Solr Cloud. My environment: rails 3.2.1, ruby 2.1.2, sunspot 2.1.0, Solr 4.1.6. Why SolrCloud: I need more stable system - oftentimes search server goes on maintenance and web application stop working on production. So, I think about how to make 2 identical search servers instead of one, to make system more stable: if one server will be down, other will continue working. I cannot find any good turtorial with simple, easy to

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('

Sunspot and RSpec fail. The commit doesn't seem to be working

时间秒杀一切 提交于 2019-12-07 09:04:57
问题 I've got a few tests running with RSpec for a Rails site, but despite following the instructions things aren't quite behaving themselves. I create an article via a Factory, run Sunspot.commit and then check the results. I always seem to draw a blank though. When I test it manually via the console or through the website it all works find though. Any ideas? How can I output the sunspot logs to see what's going on? My Gemfile has the following, and I'm running Rails 3.1.1 gem 'sunspot', '1.2.1'

Sunspot/Solr queries ending with logical operators AND/OR/NOT result in error

主宰稳场 提交于 2019-12-05 21:27:49
I noticed that queries ending with logical operators like AND/OR/NOT example ('this AND') will result in an error. Now what would be the best way to handle this? Just trim out or escape all the queries ending with one of those? Note that it also happens for queries starting with one of these words. And sometimes, valid names end with such words, like Oregon OR. I believe escaping any AND/OR/NOT instances in your query that aren't meant to be boolean logic would be your best bet: Article.search do fulltext 'Oregon OR' end # => Throws error along the lines of this: # RSolr::RequestError: Solr

Sunspot and RSpec fail. The commit doesn't seem to be working

夙愿已清 提交于 2019-12-05 13:28:32
I've got a few tests running with RSpec for a Rails site, but despite following the instructions things aren't quite behaving themselves. I create an article via a Factory, run Sunspot.commit and then check the results. I always seem to draw a blank though. When I test it manually via the console or through the website it all works find though. Any ideas? How can I output the sunspot logs to see what's going on? My Gemfile has the following, and I'm running Rails 3.1.1 gem 'sunspot', '1.2.1' gem 'sunspot_rails' gem 'sunspot_test' Many thanks, Graeme It was my fault for not reading the manual

rake sunspot:solr:reindex not working in Rails 4 app with multiple engines

时光怂恿深爱的人放手 提交于 2019-12-05 01:38:01
问题 I have rails 4 beta1 application with multiple engines. I've installed sunspot_rails gem /2.0.0.pre.130115/ in my host application. Most of my models lived in engine1. I used them on other engines. After I installed sunspot_rails, using rake sunspot:solr:run I got command/task not found . According to documentation I found a solution. Here is the link: https://github.com/sunspot/sunspot/wiki/Adding-Sunspot-search-to-Rails-in-5-minutes-or-less After I created a new record Solr found it in a

sunspot solr how to search multiple models correctly? All examples online fail

跟風遠走 提交于 2019-12-05 00:34:17
问题 How would one correctly search multiple models in SunSpot Solr? Profile model has_one :match searchable do string :country string :state string :city end Match model belongs_to :profile searchable do string :looking_for_education integer :age_from integer :age_to end ProfilesController#Index def index @search = Sunspot.search Profile, Match do with(:country, params[:country]) with(:state, params[:state]) with(:looking_for_education, params[:looking_for_education]) <= from the 2nd model end