sunspot

sunspot return all results for a model

巧了我就是萌 提交于 2020-01-04 05:19:12
问题 I have in my controller this: def boards @user = User.find_by_slug(params[:id]) @search = @user.boards.solr_search do |s| s.fulltext params[:search] s.keywords params[:search] s.order_by :created_at, :desc s.paginate :page => params[:page], :per_page => 1 end @boards = @search.results respond_to do |format| format.html { render :layout => nil}# panel.html.erb format.json { render json: @boards } format.js end end In my view: <table id="body_object"> <% for board in @boards %> <tr class=

Solr Search Using Susnpot Gem

心不动则不痛 提交于 2020-01-03 17:47:17
问题 I am currently using the sunspot gem to implement full text search in my rails application. Queries on my website through Sunspot/Solr are working and returning the proper results. However, when I attempt to make a query using the Solr admin page, I am having a hard time displaying results. Using the query string *:* I can display all the results contained in my indexed database, but I cannot make a proper query. If I try to make a query using a string other than *:* , such as test , no

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.

Can't reindex Sunspot SOLR - Error - RSolr::Error::Http - 500 Internal Server Error

人走茶凉 提交于 2019-12-29 07:29:31
问题 Everytime i try to reindex using... rake sunspot:solr:reindex These error messages always show: Error - RSolr::Error::Http - 500 Internal Server Error - retrying... Error - RSolr::Error::Http - 500 Internal Server Error - ignoring... Error - RSolr::Error::Http - 500 Internal Server Error - retrying... Error - RSolr::Error::Http - 500 Internal Server Error - ignoring... I tried to stop then start using... rake sunspot:solr:stop rake sunspot:solr:start But nothing happened. And now everytime I

Indexing and ordering by dynamic field with sunspot

徘徊边缘 提交于 2019-12-25 06:54:56
问题 So I have many items that can be part of many different pages. So here is the simplified models: class Page #we just need the id for this question end class Item embeds_many :page_usages end class PageUsage field :position, :default => 0 embedded_in :item belongs_to :page end So the page_usage is holding the position of the items on every page. I want to put that into solr so it can pull up the right items and in the right order for me. I've looked into dynamic fields and ended up with

Lucene term boosting with sunspot-rails

南笙酒味 提交于 2019-12-24 17:25:17
问题 I'm having an issue with Lucene's Term [Boosting][1] query syntax, specifically in Ruby on Rails via the sunspot_rails gem. This is whereby you can specify the weight of a specific term during a query, and is not related to the weighting of a particular field. The HTML query generated by sunspot uses the qf parameter to specify the fields to be searched as configured, and the q parameter for the query itself. When the caret is added to a search term to specify a boost (i.e. q=searchterm^5) it

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

Cannot seed database; not working because of refused connection?

孤人 提交于 2019-12-24 00:43:00
问题 When I try to seed my application I get the error: No connection could be made because the - target machine actively refused it. - connect(2) I believe the reason why is because I was having issues with mysql2 so I uninstalled it along with the MySQL 5.5 Servers and then switched to sqlite3. I think the server for mysql2 is running in the background so this could be the issue. How would I fix this? How would I turn off the Mysql2 local host server or whichever server it is that's causing this

Solr: Can't search for numbers mixed with characters

亡梦爱人 提交于 2019-12-23 11:59:34
问题 I have some items in my index (Solr. 4.4), which contain names like Foobar 135g , where the 135g refers to some weights. Searching for foobar or foobar 135 does work, but when I try to search for the exact phrase foobar 135g , nothing is found. I analysed the query inside the solr admin panel "Analysis". Here everything looks good. The fields are indexed correctly, the query is splitted correctly, and I get hits (indicated by this purple background on the tokens). But there has to be an issue

EdgeNGramFilterFactory not working (not indexing?)

孤街醉人 提交于 2019-12-23 04:03:29
问题 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