sunspot

How do I set up a facet search with a many to many relationship using Sunspot?

我们两清 提交于 2019-12-03 05:17:43
问题 I haven't implemented a search feature before and feel a bit stuck. I have a Sunspot search feature which finds results based on keywords - this works great - but I now want to implement the multi select facet feature, but I can't even seem to figure out how to set-up a basic facet search. I have a many to many relationship (in rails not in real life): Class People has_many :skills, :through => experience (and vice versa etc) Class People < ActiveRecord::Base has_many :skills, :through =>

How to rotate, override, or turn off logging from Sunspot Solr Rubygem?

℡╲_俬逩灬. 提交于 2019-12-03 03:28:47
I've had great experiences with Sunspot Solr search for Ruby on Rails, however, its log files are growing incredibly large and I can't seem to find a way to either rotate , override , or turn off these logs (other than with very hacky methods that I'd rather not pursue). I have a file, sunspot.yml in config/ , where I tried setting the log_level flags to SEVERE , however, this had no effect. I tried using the standard Logger.config rotation methods, however, that just sent my development log output to newly created files. I would greatly appreciate any suggestions you can offer. It's a bit

Querying multiple models with different attributes using Sunspot

北战南征 提交于 2019-12-03 00:28:07
I'm using Sunspot to index and search several models in a Rails project and I need to limit results based on the models' HABTM associations with a Department model. This is because users may not have permission to see records in all departments so results from those departments shouldn't be returned. Here are the important parts of two of the models: class Message < ActiveRecord::Base has_many :comments, dependent: :destroy has_and_belongs_to_many :departments searchable do text :title, :body text :comments do comments.map(&:body) end date :created_at integer :department_ids, using:

Sunspot-Solr slowing down to a beast once my Application climbed to > 1000 objects [ Solr Logs Included ]

岁酱吖の 提交于 2019-12-02 19:50:42
I'm curious if anyone noticed any scaling issues with Sunspot-Solr . Even if I remove all the searchable params, and its just counting against the raw class by itself; it still takes 5 to 8 seconds to load on my local, 4 to 5 seconds on production. Has anyone else been able to scale Sunspot-Solr ? What are some common problems? How can one look into this deeper? Here's the Solr Logs for a single request : Solr Select (208.1ms) {:rows=>20, :start=>0, :q=>"*:*", :sort=>"score desc", :fq=>["type:Organization", "published_b:true", "updated_at_d:[2009\\-02\\-03T16\\:11\\:55Z TO *]"]} Solr Select (5

Sunspot with multiple models (in Rails)

℡╲_俬逩灬. 提交于 2019-12-02 17:17:40
I have three models ( User , Tag , Product ) and they interact s.t. User has many Tags and Products . For searching purposes, I would like to be able to search (with one search bar) on user names, tag names, and product descriptions. I would also like to search on product pages, but that is only relevant for tag names and product descriptions. Here are two examples: Search: "Linus Torvalds" returns all instances of Linus Torvalds in the three models with any instances of the user name being placed higher. Search: "Linux" with age: "20-25" returns all instances of Users with Products that

sunspot solr undefined field type

血红的双手。 提交于 2019-12-02 04:06:19
问题 I'm having a problem with my sunspot and solr. In development it worked like charme but in production I get the following error out of my rails production log: RSolr::RequestError (Solr Response: undefined field type): app/controllers/search_controller.rb:7:in `index' I guess it has something to do with the schema.xml. But I'm quite new to solr. So can anybody help me? OK: Controller def index unless params[:q].blank? @search = Question.search do fulltext params[:q] end @results = @search

Connection refused using Sunspot and Solr in Rails

旧城冷巷雨未停 提交于 2019-12-02 01:38:25
I'm having an issue wherein I get an ECONNREFUSED error when I try to perform a search using sunspot_rails. The gems (sunspot_rails and sunspot_solr) both seem to be installed properly. I'm running version 1.3.3 and I have the server running correctly. I've found another post about this, but the post only recommended starting the sunspot solr server. I've definitely done that, but the error persists. I believe the problem is due to the port the server is on. When I look at the output from RAILS_ENV=development rake sunspot:solr:run , it shows that the server is running on port 8983 . I've also

Sunspot `LIKE` query

一笑奈何 提交于 2019-12-01 11:37:42
I'm using sunspot . How can I run a LIKE query ( LIKE %q% )? I would like to do something like this: @search = Sunspot.search(User) do |q| q.text_fields { with(:company_name).like(params[:q]) } end.results instead of: @search = Sunspot.search(User) do |q| q.text_fields { with(:company_name).starting_with(params[:q]) } end.results which partially works for me. Reviewing the sunspot code, I found this piece of code: class StartingWith < Base private def to_solr_conditional "#{solr_value(@value)}*" end end It basically generates the following sunspot search hash: Sunspot.search(User) do |q| q

Sunspot `LIKE` query

五迷三道 提交于 2019-12-01 09:36:05
问题 I'm using sunspot . How can I run a LIKE query ( LIKE %q% )? I would like to do something like this: @search = Sunspot.search(User) do |q| q.text_fields { with(:company_name).like(params[:q]) } end.results instead of: @search = Sunspot.search(User) do |q| q.text_fields { with(:company_name).starting_with(params[:q]) } end.results which partially works for me. Reviewing the sunspot code, I found this piece of code: class StartingWith < Base private def to_solr_conditional "#{solr_value(@value)

Solr Sunspot minimum_match

泄露秘密 提交于 2019-12-01 09:23:38
I'm new to using Solr Sunspot for Rails. I'm trying to use the <filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" side="front"/> So naturally not all of the tokens are going to match. I can't figure out how to use the minimum_match feature in my search http://outoftime.github.com/sunspot/docs/index.html . Any help would be greatly appreciated. I tried and I just get 0 results: Articles.search do fulltext params[:q] do :minimum_match => 1 end end You're almost there. The hash syntax is when you're passing minimum match as a parameter to fulltext . Article.search do