Questions tagged [searchlogic]

86 questions
0
votes
1 answer

How to extend/subclass SearchLogic::Search?

Here is what I'm trying: app/models/product.rb class Product < ActiveRecord::Base class << self def searchlogic(conditions = {}) ProductSearch.new(self, scope(:find), conditions) end end end app/models/product_search.rb require…
maček
  • 76,434
  • 37
  • 167
  • 198
0
votes
1 answer

search by attribute_like_any using multiple words in one field [searchlogic]

My form <% form_for @search do |f| %> <%= f.input :name_like_any %> ... <% end %> Controller @search = Product.search @search.name_like_any(params[:search][:name_like_any].split(/\s+/)) @products = search.all This returns the correct result,…
maček
  • 76,434
  • 37
  • 167
  • 198
0
votes
1 answer

Which version of searchlogic works with Rails 2.1.0?

I just installed searchlogic 2.4.24 for my Rails 2.1.0 app but got the following error :- ..aliasing.rb:31:in alias_method':NameError: undefined methodmerge_joins' for class `Class' Is it a version conflict? Does anyone know which version of…
Vinay
  • 105
  • 5
0
votes
1 answer

Searchlogic on associations

I have the following associations: class BookShelf { has_many :books } class Book { has_many :pages belongs_to :book_shelf } class Page { belongs_to :book } If I have a BookShelf object, how could I use searchlogic to search pages that…
PeterWong
  • 15,951
  • 9
  • 59
  • 68
0
votes
2 answers

Ruby on Rails Controller Error in Search

I am facing the below error after I removed two fields middle_name, last_name from the Student migration thru another migration. below are the errors. Searchlogic::NamedScopes::OrConditions::UnknownConditionError in…
Naveed
  • 59
  • 2
  • 13
0
votes
1 answer

Using searchlogic in Rails to find records by created_at year

I'm working on a Rails app wherein I want to be able to search for records created in a given year using the Searchlogic gem, but I can't figure out how to have Searchlogic only search by year. I tried this in my search form: <%=…
Eric K
  • 277
  • 2
  • 3
  • 8
0
votes
1 answer

How do I order associated objects with searchlogic in views?

Hello again great knowledge masters of stackoverflow, once again the small coder apprentice tabaluga is in need of help The Goal : make the username sortable in the view. The difficulty is, that I am Querying Profiles in the controller (…
tabaluga
  • 1,377
  • 4
  • 20
  • 27
0
votes
1 answer

searchlogic returns nil when I order my records

I can't figure out why ascend_by won't work for me. Here's a console readout >> tapes = Tape.search(:timestamp_gte => "1278361923") => blah blah blah >> tapes.length => 1436 >> tapes.ascend_by_timestamp => nil I get the same behavior when I use…
muirbot
  • 2,061
  • 1
  • 20
  • 29
0
votes
1 answer

rails searchlogic and will_paginate undefined method `order' for #

Does anyone have the same problem or a working solution? I get always this error message, here are model, controller and view code class Profile < ActiveRecord::Base cattr_reader :per_page @@per_page = 10 end def index @search =…
tabaluga
  • 1,377
  • 4
  • 20
  • 27
0
votes
1 answer

using searchlogic with habtm associations

I have the following issue: I have two classes in my rails app, joined by a HABTM association, like so: #ad.rb has_and_belongs_to_many :specs #spec.rb has_and_belongs_to_many :ads joined by an ads_specs table. I'm trying to perform a search on the…
alex.g
  • 187
  • 1
  • 7
0
votes
1 answer

How do I search for a phrase using search logic?

Imagine case scenario, you have a list of recipes that have ingredients as a text. You want to see how many recipes contain "sesame oil". The problem with default searchlogic searching using Recipe.ingredients_like("sesame oil") is that any recipe…
fivetwentysix
  • 7,379
  • 9
  • 40
  • 58
0
votes
1 answer

Use named_scope to find number of associated rows (Ruby on Rails + Searchlogic question)

Let's say I have: class ForumTopic < ActiveRecord::Base has_many :forum_posts named_scope :number_of_posts, ?????? end class ForumPost < ActiveRecord::Base belongs_to :forum_topic end What should I put in ????? to allow searchlogic query…
jaycode
  • 2,926
  • 5
  • 35
  • 71
0
votes
1 answer

display all available named scopes of a model in Ruby on Rails

Especially when you are using Searchlogic. It is kinda hard for me to guess what named scope to use to achieve what I need.
jaycode
  • 2,926
  • 5
  • 35
  • 71
0
votes
1 answer

searchlogic and virtual attributes

Let's say I have the following model: Person
Hermine D.
  • 1,119
  • 3
  • 14
  • 19
0
votes
1 answer

ruby on rails, searchlogic and refactoring

I'mt not too familiar with searchlogic plugin for rails (I did view the railscasts but wasn't helpful in relation to the specific code below). Can anyone briefly describe how it is being used in the three methods below? Thanks for any response. …
JohnMerlino
  • 3,900
  • 4
  • 57
  • 89