sunspot

Rails 3 Sunspot Fulltext Search Usage

谁都会走 提交于 2019-12-08 05:13:07
问题 So I've implemented the sunspot_rails gem into my application to utilize the powerful Solr search engine. I recently checked out Ryan's railscast on full-text searching and I noticed he was using additional parameters in his search queries such as "-" to denote something that should NOT be including in the full-text search. I never heard about this until now, I was wondering if there was a user-friendly usage guide somewhere both me and my users can reference to take my search functionality

Rails: Sunspot text searching with model associations, using :through

旧时模样 提交于 2019-12-08 01:33:39
问题 How do I search with associations and through with sunspot? class StaticController < ApplicationController def search @search = Sunspot.search Business, Service do fulltext params[:q] paginate :per_page => 10 order_by_geodist(:location, *Geocoder.coordinates(params[:loc])) end @biz = @search.results end class Business < ActiveRecord::Base attr_accessible :name has_many :services, :through => :professionals searchable do text :name #name in business column # how to do I get the services? end

EdgeNGramFilterFactory not working (not indexing?)

折月煮酒 提交于 2019-12-07 19:18:25
I am having trouble getting ngrams to work. Here's my schema.xml: <fieldType name="text" class="solr.TextField" omitNorms="false"> <analyzer type="index"> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.StandardFilterFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="25" /> </analyzer> <analyzer type="query"> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.StandardFilterFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.SynonymFilterFactory"

Sunspot geospatial search ERROR:unknown field 'location_ll'

99封情书 提交于 2019-12-07 17:14:14
问题 I've been trying to integrate geospatial search into my rails app for a few days now, but keep getting this error when I run rake sunspot:solr:reindex RSolr::Error::Http - 400 Bad Request Error: ERROR:unknown field 'location_ll' Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><add><doc><field name=\"id\">Place 1</field><field name=\"type\">Place</field><field name=\"type\">ActiveRecord::Base</field><field name=\"class_name\">Place</field><field name=\"location_ll\">42.348065,-71

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 Search like Rails active record 'LIKE' search

烂漫一生 提交于 2019-12-07 05:21:45
问题 Hi I have been using the normal rails active record LIKE search in my app, I started using sunspot solr search. I would like it to act as close to the rails LIKE search as possible. wine.rb #sunspot stuff searchable :auto_index => true, :auto_remove => true do text :name end #sunspot stuff solr/conf/schema.xml <fieldType name="text" class="solr.TextField" omitNorms="false"> <analyzer> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.StandardFilterFactory"/> <filter class

Sunspot / Solr full text search - how to index Rails associations

时间秒杀一切 提交于 2019-12-07 01:06:06
问题 Is it possible to index through an association with Sunspot? For example, if a Customer has_many Contacts, I want a 'searchable' block on my Customer model that indexes the Contact#first_name and Contact#last_name columns for use in searches on Customer. acts_as_solr has an :include option for this. I've simply been combining the associated column names into a text field on Customer like shown below, but this doesn't seem very flexible. searchable do text :organization_name, :default_boost =>

Rails 3 Sunspot Fulltext Search Usage

情到浓时终转凉″ 提交于 2019-12-06 15:28:08
So I've implemented the sunspot_rails gem into my application to utilize the powerful Solr search engine. I recently checked out Ryan's railscast on full-text searching and I noticed he was using additional parameters in his search queries such as "-" to denote something that should NOT be including in the full-text search. I never heard about this until now, I was wondering if there was a user-friendly usage guide somewhere both me and my users can reference to take my search functionality to it's maximum capability. I think ideally I would like to make an abridged version similar to Github's

How Do I Scope Enums in Rails Using Sunspot?

拥有回忆 提交于 2019-12-06 14:07:04
I am trying to use Sunspot (Rails Solr gem) to scope results using an enum I have declared in my model. The relevant portion of my model looks like this: searchable do text :tag_list boolean :approved integer :perspective time :created_at end enum perspective: [ :not_applicable, :front, :side_front, :side, :side_back, :back, :above, :below ] My search block in my controller looks like this: def index //skip scoping if perspective is nil params[:perspective] ||= [] @search = Upload.search do with :approved, true with :perspective, params[:perspective] fulltext params[:tag] fulltext params[

Rails: Sunspot text searching with model associations, using :through

这一生的挚爱 提交于 2019-12-06 12:06:11
How do I search with associations and through with sunspot? class StaticController < ApplicationController def search @search = Sunspot.search Business, Service do fulltext params[:q] paginate :per_page => 10 order_by_geodist(:location, *Geocoder.coordinates(params[:loc])) end @biz = @search.results end class Business < ActiveRecord::Base attr_accessible :name has_many :services, :through => :professionals searchable do text :name #name in business column # how to do I get the services? end end class Service < ActiveRecord::Base attr_accessible :service belongs_to :professional end class