sunspot

Connection refused using Sunspot and Solr in Rails

梦想与她 提交于 2020-01-30 06:24:26
问题 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

How to use globalize and sunspot in rails 4

不羁的心 提交于 2020-01-24 04:30:06
问题 How do i index arabic profile translations with sunspot solr. Can i use globalize and sunspot or should use some other approach? models/profile.rb translates :name, :description validates :name validates :description searchable do text :name text :description end 回答1: You can define separate fields for each of your locales in your search block: I18n.available_locales.each do |locale| # Separate name field for each locale text "name_#{locale}".to_sym do # read_Attribute is defined by Globalize

solr autocomplete with scope is it possible?

风格不统一 提交于 2020-01-15 11:44:31
问题 I'm dig into solr configuration stuff and try to figure out how implement autocomplete feature. Some details mentioned here http://wiki.apache.org/solr/Suggester/ But I don't want use same dictionary for all site - it is not useful when you have some private data. I mean several companies use search and I want make autocompleate based only on company data. Is it possible to limit autocompleate results scope them with some syntax. I'm working with Rails 3 and sunspot gem and solr 3.6 Update: I

How to restrict Sunspot search with nested models?

孤者浪人 提交于 2020-01-15 06:35:10
问题 I want to filter the Sunspot search results with with(:is_available, true) . This is working with the User model, but I can't make it work with the Itinerary model. app/controllers/search_controller.rb: class SearchController < ApplicationController before_filter :fulltext_actions private def fulltext_actions @itineraries = do_fulltext_search(Itinerary) @users = do_fulltext_search(User) @itineraries_size = @itineraries.size @users_size = @users.size end def do_fulltext_search(model) Sunspot

How to restrict Sunspot search with nested models?

独自空忆成欢 提交于 2020-01-15 06:34:29
问题 I want to filter the Sunspot search results with with(:is_available, true) . This is working with the User model, but I can't make it work with the Itinerary model. app/controllers/search_controller.rb: class SearchController < ApplicationController before_filter :fulltext_actions private def fulltext_actions @itineraries = do_fulltext_search(Itinerary) @users = do_fulltext_search(User) @itineraries_size = @itineraries.size @users_size = @users.size end def do_fulltext_search(model) Sunspot

How highlight found word with Sunspot?

微笑、不失礼 提交于 2020-01-13 10:41:33
问题 I want to highlight found words in text, for example, as shown here. As far as I know I must follow these steps: 1) In my model, I must add :stored => true option to the field which I want to highlight: searchable do text :title, :stored => true text :description end 2) In my controller, I have to declare which field I want highlighted: def search @search = Article.search do keywords params[:search] do highlight :title end end end 3) In the view I'm not sure what to do, I tried this: -

Sunspot/Solr raketasks not loading in Rails 3 Mountable Engine

泄露秘密 提交于 2020-01-13 07:00:49
问题 I'm trying to add the sunspot_rails gem to my Rails Mountable Engine, so I can use Solr to do full text searches. Like it states in the README file I've added this to my Gemfile: gem "sunspot_rails" gem "sunspot_solr" Then I run rails g sunspot_rails:install which creates sunspot.yml in the config folder of my Rails Engine. To start sunspot I need to run: bundle exec rake sunspot:solr:start But that doesn't work, and gives me the following error message: rake aborted! Don't know how to build

Sunspot / Solr / Rails: Model Associations are not updating in the Index

眉间皱痕 提交于 2020-01-12 05:43:26
问题 I have a Fieldnote model in my app, which has_many :activities attached to it through a table called :fieldnote_activities. I then define a searchable index this way: searchable :auto_index => true, :auto_remove => true do integer :id integer :user_id, :references => User integer :activity_ids, :multiple => true do activities.map(&:id) end text :observations end And then I have a Search model to store / update searches. The search model thus also has its own associations with activities. I

Elastic Search equivalent of “Scoping (Scalar Fields)” in sunspot/solr

本小妞迷上赌 提交于 2020-01-06 07:15:35
问题 I'm exploring various options for a search engine for our rails-app/data. I was able to make sunspot/solr work and am currently exploring ElasticSearch as an alternative but couldn't get the same thing(scoping/filtering) to work under ES. I would like to filter/scope objects as described in the "Scoping" section in 'https://github.com/sunspot/sunspot'. I have an active record class 'Product'. class Product < ActiveRecord::Base ... include Tire::Model::Search include Tire::Model::Callbacks

Rails Sunspot filter / facet issue with URL? Deleting old “get params”

▼魔方 西西 提交于 2020-01-05 04:45:07
问题 I'm trying to understand and set up Sunspot gem in my Rails 4.0 project. I'm trying to implement a better search in my open-source project, BTC-Stores, but I'm a bit confused about how to do that with Sunspot. Currently, I have the following architecture (model): Item: # Relationship with Category belongs_to :category accepts_nested_attributes_for :category searchable do text :name, :description integer :category_id string :sort_name do # why I have this here? I dont understand this code name