{"id":2421,"date":"2022-08-30T15:24:43","date_gmt":"2022-08-30T15:24:43","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/12\/problem-about-meta-search-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:24:43","modified_gmt":"2022-08-30T15:24:43","slug":"problem-about-meta-search-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problem-about-meta-search-collection-of-common-programming-errors\/","title":{"rendered":"problem about meta-search-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d32f25ab2112110cebb2ed4b86e87920?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPratik Khadloya<br \/>\nruby-on-rails ruby-on-rails-3 meta-search<br \/>\nI am in the process of upgrading my app from Rails2 to Rails3. My Rails2 app uses searchlogic heavily. After googling i&#8217;ve come to know that searchlogic is not compatible with Rails3 and need to use meta_search instead. But i havent quite understood the usage of meta_search vis-a-vis searchlogic. If i have a User model with :name and :address fields, i am not able to use the following methods with meta_search. What am i doing wrong? ruby-1.9.2-p0 &gt; User.name_null NoMethodError: undefined<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3c92ccd1c81ee87acbc011e77b31bb2a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJords<br \/>\nruby-on-rails meta-search tire<br \/>\nI&#8217;m using active_admin and that&#8217;s bringing in meta_search to my project. (Which I don&#8217;t want to use for anything else).It seems to be defining the search method on all my models, which then means when I include tire, I can&#8217;t use it&#8217;s search method.There seems to be something strange with how it&#8217;s defining the method also &#8211; method_defined? says that the search method is not defined, yet when I call it I get the meta_search one. Even if I define my own search method in the class, when I call Docum<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b63c2d00125474973e2c1919f610fd92?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRainChen<br \/>\nruby mongoid meta-search<br \/>\nI tried meta_search, but after adding &#8220;include MetaSearch::Searches::ActiveRecord&#8221; into my model, it raised an error as &#8220;undefined method `joins_values'&#8221; when run &#8220;MyModel.search(params[:search])&#8221;I think I dont need full text, so I think following gems are not suitable for my project now:: mongoid_fulltext mongoid-sphinx sunspot_mongoid mongoid_searchI tried a old gem named scoped-search I can make it work for example:get :search do@search = Notification.scoped_search(params[:search]searc<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8cf948db8bafc4606864cc26f8501e84?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBrian W<br \/>\nruby-on-rails ruby activeadmin meta-search<br \/>\nI&#8217;m trying to simply allow filtering of categories on the Locations page for ActiveAdmin.I have three models:class Location &lt; ActiveRecord::Basehas_many :categories_locationshas_many :categories, :through =&gt; :categories_locationsclass CategoriesLocation &lt; ActiveRecord::Basebelongs_to :categorybelongs_to :location endclass Category &lt; ActiveRecord::Basehas_many :categories_locationshas_many :locations, :through =&gt; :categories_locations endOn my locations page, I&#8217;m using this filter:<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/459b9ff2f2f1773e9ec15d4b6ef60e14?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\njeremiahishere<br \/>\nkaminari meta-search<br \/>\nI am using Kaminari for pagination and trying to use meta_search for column ordering. I would like my code to look like this:@search = Organization.search(params[:search]) @organizations = @search.page(params[:page])When I write it this way, I am getting the error, undefined method `page&#8217; for #&lt;MetaSearch::Builder:0x7fadb8958630&gt;The solution I have found is this:@search = Organization.search(params[:search]) @organizations = Kaminari.paginate_array(@search.all).page(params[:page]It works<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e731af79d198e0c2263695da245e0996?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\njklina<br \/>\nruby-on-rails ruby-on-rails-3 meta-search scopes<br \/>\nIn my Widget model I have the following:scope :accessible_to, lambda { |user|if user.has_role?(&#8216;admin&#8217;)self.allelseroles = user.rolesrole_ids = []roles.each { |r| role_ids &lt;&lt; r.id }self.joins(:widget_assignments).where(&#8216;widget_assignments.role_id&#8217; =&gt; role_ids)end }Ideally, I would like to use this scope as a filter for Ransack&#8217;s search results, so in my controller I have:def index@q = Widget.accessible_to(current_user).search(params[:q])@widgets = @q.result.order(&#8216;created_at DESC&#8217;) endD<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/56de7700298f470227990ba23202e6a4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nere<br \/>\nruby-on-rails ruby-on-rails-3 meta-search texticle<br \/>\nI use the active_admin gem which requires the meta_search gem and noticed it conflicts with texticle as they both use the search method and it breaks as a result. I read in a few places about similar problems involving solr where they were able to user an alternative method solr_search but I found no such luck using texticle.NoMethodError (undefined method `relation&#8217; for []:ActiveRecord::Relation):Any ideas how I can avoid this?<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/77c2eb221c3a3dbe9a6c23fc67f94ea2?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGeoffrey Hug<br \/>\nruby-on-rails ruby-on-rails-3 pagination meta-search<br \/>\nI&#8217;m trying to paginate my search results from metasearch but I get a undefined method `paginate&#8217; for #&lt;ActiveRecord::Relation:0x6d3df28&gt;This is the code in my controller :@search = Camping.search(params[:search])if !params[:search].nil?@campings = @search.paginate(:page =&gt; params[:page]) else@campings = []; endThis should be so simple I really don&#8217;t see what&#8217;s wrong&#8230;I have those in my gem file :gem &#8216;will_paginate&#8217;, &#8216;3.0.3&#8217; gem &#8216;bootstrap-will_paginate&#8217;, &#8216;0.0.6&#8217;<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/616f6a736907101ec0b50b8a824b7946?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nYasser<br \/>\nruby-on-rails-3 activeadmin formtastic meta-search<br \/>\nI&#8217;ve a table with an integer column called &#8220;map_id&#8221;, I want to add an activeadmin filter to filter if this column IS NULL or IS NOT NULL.How could this be implemented ?I tried the following filterfilter :map_id, :label =&gt; &#8216;Assigned&#8217;, :as =&gt; :select, :collection =&gt; {:true =&gt; nil, :false =&gt; &#8221;}But, I get the following error message :undefined method `map_eq&#8217; for #<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b6640a9a125eb5cf2bc47ddc17b8ee7a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRafael Oliveira<br \/>\nruby-on-rails ruby-on-rails-3 meta-search<br \/>\nI&#8217;m using fantastic MetaSearch by Ernie, but I&#8217;m having an annoying issue.In my application.html.erb I have an search field, just like this one on top of StackOverflow page.&lt;%= form_for @search, :url =&gt; vagas_path do |f| %&gt;&lt;%= f.text_field :titulo_or_empresa_user_username_contains %&gt;&lt;%= f.submit &#8220;&#8221;, :class =&gt; &#8220;search-button&#8221;, :name =&gt; &#8220;submit&#8221; %&gt; &lt;% end %&gt;The problem is that I don&#8217;t have @search initialized in all actions of all controllers, so when I&#8217;m not at Va<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5dd0d56ea1dd784126cda196a9ce9e13?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJamesWatling<br \/>\nruby-on-rails search meta-search<br \/>\nI am working with a rails app and have begun to work on a search function using metasearch but I am having troubles getting the correct method for the search.For example I have a model (Proposal) that has a field cost&#8230;model\/proposal.rbclass Proposal &lt; ActiveRecord::Base belongs_to :user has_many :users, :through =&gt; :invitations attr_accessible :cost, :user_idFor which this code works fine with meta search..views\/homes\/live_requests.html.erb&lt;%= form_for @search, :url =&gt; &#8220;\/live_reque<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/80a177676cc8519ca20a49a89ffbba56?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nndemoreau<br \/>\nruby-on-rails activerecord meta-search<br \/>\nI&#8217;m new to rails and need your help for what should be a simple problem.when I run this code:@search = User.search(params[:search]) @foundusers = @search.all.paginate :page =&gt; params[:page], :per_page =&gt; 20 @user = @search.where(&#8220;users.id = ?&#8221;, params[:id]) if @user.nil?@user = @foundusers.first end unless @user.company_id.nil?@company = Company.find(@user.company_id) endI get following error statement: undefined method `company_id&#8217; for #I dont understand because the query on the database<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3fe604b3bfc7d06d772eb60686a5cb62?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNicdeMor<br \/>\nruby-on-rails activerecord meta-search<br \/>\nI&#8217;m new to rails and need your help for what should be a simple problem.when I run this code:@search = User.search(params[:search]) @foundusers = @search.all.paginate :page =&gt; params[:page], :per_page =&gt; 20 @user = @search.where(&#8220;users.id = ?&#8221;, params[:id]) if @user.nil?@user = @foundusers.first end unless @user.company_id.nil?@company = Company.find(@user.company_id) endI get following error statement: undefined method `company_id&#8217; for #I dont understand because the query on the database<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3d47278f76ad923d97393f71752d9ada?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nTiago Veloso<br \/>\nruby-on-rails-3 meta-search<br \/>\nI am working on a rails 3 app, I am trying to use the meta_search gem.After adding the gem to the GemFile and running bundle install, it seems that there is no search method.undefined method `search&#8217; for #&lt;Class:0x00000104134458&gt;I am using something similar to the examples:@search = Bill.search(params[:search]) @bills = @search.allAnyone experienced this before?<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2014-01-12 04:47:52. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Pratik Khadloya ruby-on-rails ruby-on-rails-3 meta-search I am in the process of upgrading my app from Rails2 to Rails3. My Rails2 app uses searchlogic heavily. After googling i&#8217;ve come to know that searchlogic is not compatible with Rails3 and need to use meta_search instead. But i havent quite understood the usage of meta_search vis-a-vis searchlogic. If [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2421","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2421"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2421\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}