sunspot-rails


Sunspot — Boost records where matches occur early in the text

流过昼夜 提交于 2020-01-03 16:44:56
问题 For example, let's say there is a record in my DB that has the text "Hormel Corporation" and my search term is something like "Hormel Corned Beef 16 Ounces" . As my current configuration stands, the top results will be other records, even though "Hormel Corporation" is the one I'm looking for. I think the solution to my problem would be to give priority to records where a match comes earliest in the search term. I've read all the docs, but I have had trouble figuring out how this might work.

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

人走茶凉 提交于 2020-01-02 07:42:21
问题 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. 回答1: 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

bash aliases not recognized by a bash function: sunspot_rails, jruby, rspec

守給你的承諾、 提交于 2019-12-24 10:39:44
问题 Aliases below for running sunspot in the background work Aliases below for finding and killing those instances work ENV variables for the sunspot ports are accessible But, Functions for running sunspot, processing command, and killing sunspot only work after I source .bashrc outside of the function. $user_id is set before this sunspot_ports() gets called and prints properly when first logging in rebash is an alias for source ~.bashrc I have aliases for development and production as well -

Error using progress bar: Max must be a positive integer

情到浓时终转凉″ 提交于 2019-12-24 00:53:30
问题 Whenever I reindex a with solr, I get the following error $ RAILS_ENV=development rake sunspot:solr:reindex Error using progress bar: Max must be a positive integer How do I fix this? 回答1: The possible reason is, your database to reinstall has no data. The progress bar is to show "how much has reindexed / how much records in DB". So if you have no data, the progress bar can't be initialized. Sunspot is expected to show a better error message 来源: https://stackoverflow.com/questions/26435813

How do I dynamically build a search block in sunspot?

孤者浪人 提交于 2019-12-21 04:55:27
问题 I am converting a Rails app from using acts_as_solr to sunspot. The app uses the field search capability in solr that was exposed in acts_as_solr. You could give it a query string like this: title:"The thing to search" and it would search for that string in the title field. In converting to sunspot I am parsing out field specific portions of the query string and I need to dynamically generate the search block. Something like this: Sunspot.search(table_clazz) do keywords(first_string, :fields

Solr will use Highlighter instead of FastVectorHighlighter warning

ε祈祈猫儿з 提交于 2019-12-13 04:48:07
问题 Hi I'm developing rails app with Solr 4.1 search engine, When I add highlighting to searchSolr start spaming the tomcat6 log with this warning: Jan 29, 2015 12:13:38 PM org.apache.solr.highlight.DefaultSolrHighlighter useFastVectorHighlighter WARNING: Solr will use Highlighter instead of FastVectorHighlighter because *Field_Name* field does not store TermPositions and TermOffsets. Example of my field in schema.xml: <field name="name" type="text" indexed="true" stored="true" multiValued="true"

Don't split on underscore with solr.StandardTokenizerFactory

醉酒当歌 提交于 2019-12-12 15:20:27
问题 I'm using solr, I'm using StandardTokenizerFactory in the text field but I don't want to split on the underscore. Do I have to use another toknizer like PatternTokenizerFactory or I can do this with StandardTokenizerFactory ? as I need the same functionality of StandardTokenizerFactory but without split on underscore. 回答1: I don't think you can do it in StandardTokenizerFactory. One solution is to first replace underscores with something the StandardTokenizerFactory won't process and

autocomplete in Solr and sunspot

微笑、不失礼 提交于 2019-12-12 04:33:19
问题 I'm building a website with RoR and I use Sunspot and the solr Search Engine. I needed to use autocomplete functionality but I couldn't. I knew that Solr has a new thing called suggester but I don't know how to use this with sunspot and in a rails app. I found a gem called sunspot_autocomplete and I followed what was written, but when I try to reindex I get this error : rake aborted! RSolr::Error::Http - 400 Bad Request Error: ERROR:unknown field 'tags_ac' The model that is searchable called

rails sunspot solr search by keywords

元气小坏坏 提交于 2019-12-11 19:14:02
问题 I am working around search for 2 days to query keyword search using sunspot solr . I am unable to understand My expected output is if i search for laptops in US it should search for laptop and us But the below code search only laptops and not the other words. How can i achieve it. My fulltext is working good I have edited schema.xml <fieldType name="text" class="solr.TextField" omitNorms="false"> <analyzer> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr

how to run sunspot reindex in background for every four hours

家住魔仙堡 提交于 2019-12-11 16:49:34
问题 I want to execute rake sunspot:reindex RAILS_ENV=production command for every four hours. To achieve this i have written simple bash script using shell programming. I will run successfully in terminal but if i tried to run it in crontab then it is not working. Operating system which am using is centos. Here is my bash script code #!/bin/bash #export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin export PATH=/usr/local/rvm/gems/ruby-1.9.2-p290/bin:/usr/local/rvm/gems/ruby-1

工具导航Map