Hi all, Thanks to the feedback and rake, search_generator now has 50% less instructions :-). 1) gem install search_generator 2) script/generate search Search 3) Read README_SEARCH that is generated for customization instructions If you still want the .tgz or .zip files, feel free to download them: http://www.hinegardner.org/dist/pkg/ I''ll try and have some sort of demo site to search up this weekend. Anyone working on a new Hierarki site and want a search engine for it? comments and criticism are always welcome, enjoy, -jeremy -- ======================================================================= Jeremy Hinegardner jeremy-eg9WJcVQRd1EMKyauTCisw@public.gmane.org
Jeremy Hinegardner wrote:> comments and criticism are always welcome,Thanks for the gem, I followed the instructions in README_SEARCH, but what do I have to do after that? I expected that I could enter a URL to go to a basic search form, like the one described in app/views/layouts/search.rhtml. My guess was that I should go to http://myhost/search, but this results in the error at the end if this message. How do I start using it? TIA, Erik. ---8<---8<---8<-------------------------------------- NoMethodError in Search#index private method `split'' called for nil:NilClass app/controllers/search_controller.rb:15:in `search'' app/controllers/search_controller.rb:7:in `index'' Show framework trace /usr/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/base.rb:700:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/base.rb:700:in `perform_action_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/filters.rb:294:in `perform_action_without_benchmark'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/benchmarking.rb:30:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/benchmarking.rb:30:in `measure'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/benchmarking.rb:30:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/rescue.rb:79:in `perform_action'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/base.rb:330:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/base.rb:330:in `process'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/base.rb:273:in `process'' /usr/lib/ruby/gems/1.8/gems/rails-0.11.1/lib/dispatcher.rb:32:in `dispatch'' /home/solidcode/projects/technico/public/dispatch.fcgi:20 /home/solidcode/projects/technico/public/dispatch.fcgi:18:in `each_cgi'' /usr/lib/ruby/1.8/fcgi.rb:597:in `each'' /usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi'' /home/solidcode/projects/technico/public/dispatch.fcgi:18 Request Parameters: None Show session dump --- user: !ruby/object:User attributes: language: nl_NL id: "4" login: erik password: 2a91af77b2e40b4d7c496b3b0722bc931b16e516 flash: !ruby/hash:ActionController::Flash::FlashHash {} Response Headers: {"cookie"=>[], "Content-Type"=>"text/html; charset=utf-8", "Cache-Control"=>"no-cache"} Show template parameters --- language: nl htmllang: nl rescues_path: /usr/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/templates/rescues/ charset: utf-8 dialect: nl locale: nl_NL action_methods: - search - index - rss - wsdl - description flash: !ruby/hash:ActionController::Flash::FlashHash {}
On Tue, Apr 12, 2005 at 10:58:37AM +0200, Erik Terpstra wrote:> Jeremy Hinegardner wrote: > >comments and criticism are always welcome, > > Thanks for the gem, I followed the instructions in README_SEARCH, but > what do I have to do after that?point a browser web based results: http://myhost/search/<search term> rss results : http://myhost/rss/opensearch/<search term> both of those result templates need to be customized to your search. The default web based results are just plain ugly looking, and the rss feed results are probably not valid until customized for your site. But they should get you started.> I expected that I could enter a URL to go to a basic search form, like > the one described in app/views/layouts/search.rhtml.Looks like I have a user-friendliness bug. I didn''t start using a default empty search page, I guess I''ll put one it. If you put in a junk search term, then you can search from the results page.> My guess was that I should go to http://myhost/search, but this results > in the error at the end if this message.Good guess, and the fun part is, I never tested a case where I didn''t put in a search term. mea culpa. Definately a bug. I''ll add some sort of userfriendly default page when no search terms are entered. Probably not before the weekend though. Thanks for the feedback -jeremy -- =======================================================================Jeremy Hinegardner jeremy-eg9WJcVQRd1EMKyauTCisw@public.gmane.org
Jeremy Hinegardner wrote:> On Tue, Apr 12, 2005 at 10:58:37AM +0200, Erik Terpstra wrote: > point a browser > > web based results: http://myhost/search/<search term>When I do that, for example: http://myhost/search/foo I get: Unknown action No action responded to foo Maybe I forgot to configure something? I''ll put my route config at the end of this message.> I''ll add some sort of userfriendly default page when no search terms are > entered. Probably not before the weekend though.Okay, thanks. </Erik> ===ActionController::Routing::Routes.draw do |map| # Add your own custom routes here. # The priority is based upon order of creation: first created -> highest priority. # Here''s a sample route: # map.connect ''products/:id'', :controller => ''catalog'', :action => ''view'' # Keep in mind you can assign values other than :controller and :action # You can have the root of your site routed by hooking up '''' # -- just remember to delete public/index.html. # map.connect '''', :controller => "welcome" # Allow downloading Web Service WSDL as a file with an extension # instead of a file named ''wsdl'' map.connect '':controller/service.wsdl'', :action => ''wsdl'' # Install the default route as the lowest priority. map.connect '':controller/:action/:id'' # allow for searching view the route map.connect ''search/:search_terms/:count'', :controller => ''search'', :action => ''index'', :count => ''-1'' # allow for Open Search RSS feeds searching map.connect ''rss/opensearch/description.xml'', :controller => ''search'', :action => ''description'' map.connect ''rss/opensearch/:search_terms/:count'', :controller => ''search'', :action => ''rss'', :count => ''-1'' end
I had the same probablem as you for a bit, before I realized that order matters in the routes.rb file. On Wed, Apr 13, 2005 at 10:43:14AM +0200, Erik Terpstra wrote:> > web based results: http://myhost/search/<search term> > > When I do that, for example: http://myhost/search/foo > I get: > > Unknown action > > No action responded to fooIf you notice in your routes.rb below you have the default route:> # Install the default route as the lowest priority. > map.connect '':controller/:action/:id''Followed by the search_generator routes:> # allow for searching view the route > map.connect ''search/:search_terms/:count'', :controller => ''search'', :action => ''index'', :count => ''-1'' > > # allow for Open Search RSS feeds searching > map.connect ''rss/opensearch/description.xml'', :controller => ''search'', :action => ''description'' > map.connect ''rss/opensearch/:search_terms/:count'', :controller => ''search'', :action => ''rss'', :count => ''-1''Since the default route is installed in the routes file before the search routes, it his first, so the url matches the default route before the search_generator routes. The error says it is trying to invoke Search::foo(). Move the default route to the bottom of the file and you should probably see things work as expected. enjoy, -jeremy -- ======================================================================= Jeremy Hinegardner jeremy-eg9WJcVQRd1EMKyauTCisw@public.gmane.org