ruby-on-rails,solr,sunspot,sunspot-rails,sunspot-solr
thanks to google group here's the solution Model.solr_search do facet :street_name, limit: 1000 # or -1 to switch off the limit at all end ...
mysql,ruby-on-rails,solr,sunspot
How are you accessing the result? If you are calling .results method then it will fire db query. You should iterate over hits and get the require field to avoid db query.
jquery,ruby-on-rails,solr,sunspot
You can use between which accepts a range of numbers: Sunspot.search(MyModel) do with(:price).between(low_price..high_price) end If you only want to search for a minimum or maximum price, instead of between you can use greater_than_or_equal_to or less_than_or_equal_to respectively, which both accept a number: Sunspot.search(MyModel) do with(:price).greater_than_or_equal_to(low_price) end See the Sunspot Wiki for...
ruby-on-rails,ruby,search,ruby-on-rails-4,sunspot
If your models already existed before adding Sunspot you will need to create the index with bundle exec rake sunspot:solr:reindex. Future updates should automatically be added to the index....
ruby-on-rails,solr,lucene,sunspot
Based on what I can read from the Sunspot source, it appears that location fields do not support in_radius. In the examples, all calls to in_radius use :coordinates_new. It seems that :coordinates_new is of type latlong instead of location. Does using latlong instead of location solve your issue?...
ruby-on-rails-3,solr,sunspot,sunspot-solr
I changed the JRE from openJDK to Oracle and reinstalled everything. It works now.
ruby-on-rails,solr,sunspot,highlighting,searchable
So, in searching for the solution to this, I have discovered more about solr's performance. Particularly the performance hits that you take for storing fields vs just indexing them. I am starting to think that storing fields on tables with a many-to-one relationship with the table being search may not...
All the models are indexed in the same index. And sunspot will also index the classnames into the index.
solr,sunspot,solr4,sunspot-rails,sunspot-solr
Ectualy, it is my code, which works: Schema.xml: <fieldType class="solr.TextField" name="phone_number" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.NGramFilterFactory" minGramSize="3" maxGramSize="20"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter...
ruby-on-rails,search,sunspot,sunspot-rails,sunspot-solr
Yes, you can but you must write search method a little bit differently. Try something like this: def search @search = Apartment.search do |query| query.fulltext params[:search] with_price(query) end end def with_price(query) from_price = (min_price.presence || 0).to_f to_price = (max_price.presence || Apartment.maximum("price")).to_f query.with(:price).between(from_price..to_price) end ...
I got it running. First of all I had to use the latest version from the git repo gem 'sunspot_rails' , :git => 'https://github.com/sunspot/sunspot.git' gem 'sunspot_solr', :git => 'https://github.com/sunspot/sunspot.git' # optional pre-packaged Solr distribution for use in development then in the model: join(:alternate_name, :target => GeoNameAlternateName, :type => :text, :join...
One of the better kept secrets of Solr (and websolr): You can use the Solr Replication API to copy the data between two indices. If you're making a copy of the production index "prod54321" into the QA index "qa12345", then you'd initiate the replication with the fetchindex command on the...
ruby-on-rails,ruby,sunspot,sunspot-rails,sunspot-solr
To make it work you have make monkey patch Sunspot::Query::Restriction::EqualTo method. Create a new file in config/initializers directory and add this code: module Sunspot module Query module Restriction class EqualTo < Base def to_positive_boolean_phrase case @value when nil "#{escape(@field.indexed_name)}:[* TO *]" when '' %Q(#{escape(@field.indexed_name)}:[* TO ""]) else super end end...
ruby-on-rails,ruby,tomcat,solr,sunspot
I've installed solr manualy, since in repo is outdated version anyway, using this tutorial https://www.digitalocean.com/community/tutorials/how-to-install-solr-on-ubuntu-14-04. Then added to gemfile gem sunspot_solr, bundled and did rake sunspot:solr:start to generate solr/conf/schema.xml which I've copied after to opt/solr/solr/{APP_NAME} and configured my config/sunspot.yml like that development: solr: hostname: localhost port: 8983 log_level: INFO path:...
The block passed to .search may be evaluated in a different context with the help of BasicObject#instance_eval like (instance_exec, class_eval, class_exec) method, so that the method fulltext (and other DSL methods) defined for the receiver of instance_eval(maybe Refinery::Books::Book?) can be seen from the block. The magic here is Ruby changes...
You are not actually searching in the skill_ids field you have indexed. You must add something like: User.search do fulltext params[:free_text] #<-- YOU DON'T NEED THIS, PROBABLY? with(:skill_ids, params[:s_skills]) if params[:s_skills] end ...
ruby-on-rails,windows,solr,sunspot
mhh I think you could just override the method. Create an initializer --> config/initializers/sunspot.rb and put in the code you metioned.
ruby-on-rails,search,solr,sunspot
Put the following in an initializer to automatically clean sunspot calls of any UTF8 control characters: # config/initializers/sunspot.rb module Sunspot # # DataExtractors present an internal API for the indexer to use to extract # field values from models for indexing. They must implement the #value_for # method, which takes...