Comments (3)
I'm using sunspot_rails 1.3.0
from sunspot.
I'm having similar trouble - the problem I'm having is a bit different in that it's only occurring when I pass more than one object through more_like_this
, but the error it presents is extremely similar. Here's how my more_like_this
call is a bit different from yours:
mlt_results = Sunspot.more_like_this(@article, Article, Video, Event) do
fields :title
end
Here's the error that I get (again, slightly different from yours):
undefined method 'more_like_this_fields' for #<Sunspot::CompositeSetup:0x10e98d5a0>
I've been poking around trying to find the cause. I'm not certain, but I think the issue has something to do with the composite_setup.rb
file.
The lib/sunspot/composite_setup.rb
only has a def all_more_like_this_fields
block ... it does not have a def more_like_this_fields
block (see line 115 of composite_setup.rb
).
If you check out line 156 of sunspot/lib/sunspot/setup.rb
, you'll see that there's a def more_like_this_fields
block. This handles the situation where one object is provided. If more than one object is provided, then sunspot can't handle it.
To get around the issue, I separated my more_like_this
calls out, and then concatenated each of the separate results - like this:
mlt_articles = Sunspot.more_like_this(@article, Article) do
fields :title
with(:published_at).greater_than(1.months.ago)
end
mlt_videos = Sunspot.more_like_this(@article, Video) do
fields :title
with(:published_at).greater_than(1.months.ago)
end
@results = (mlt_articles + mlt_videos).sort! { |a,b| a.published_at <=> b.published_at }
from sunspot.
This must have been fixed with the latest version of the library. Please feel free to reopen if this still exist
from sunspot.
Related Issues (20)
- sunspot:solr:reindex giving RSolr::Error::ConnectionRefused: Connection refused error HOT 1
- Support rails 6 insert_all, upsert_all, update_all
- Documentation website not working HOT 2
- index not working with Ruby 3 HOT 4
- sunspot:solr:reindex not work after updating rails 6 HOT 1
- Fulltext and Scalar field search is not working with any_of
- sunspot_rails gem bump? HOT 6
- Can't make it work with Solr 8 with docker HOT 1
- Index-time Boosts not supported by Lucene 7 and Solr 8 anymore
- Sunspot RSolr Reindex Error ConnectionRefused After reindexing 99.57% of the model how to continue from where it failed
- Score boost does not work with join fields
- Retry5xxSessionProxy#rescued_exception unused
- DEPRECATION: Rsolr.new/connect option 'read_timeout' is deprecated and will be removed in Rsolr 3.
- Not able to reindexing restored couchdb HOT 1
- Search by exact match on text field is not working as expected HOT 1
- Can Opendistro Elasticsearch be used in place of Solr? HOT 1
- Psych::BadAlias in Ruby 3.1 configuration
- NoMethodError on Ruby 3.2 for `File.exists?` HOT 8
- sort param could not be parsed as a query, and is not a field that exists in the index: geodist(location_ll,32.8563846,-117.2029363)
- How to stub results?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sunspot.