Getting started with acts_as_searchable on Ubuntu

UPDATE

acts_as_searchable is no longer maintained, please switch over to the new and healthy world of search_do bug-free, clear structure and paginating!

Too many crappy tutorials around, with wrong or only partial information of how to get started. Took me almost 2 hours to get it working, so here comes a short How To/Summary for future reference.

  1. sudo apt-get install hyperestraier
  2. sudo nano /etc/default/hyperestraier (change NO_START from 1 to 0) -> autostart on boot
  3. sudo /etc/init.d/hyperestraier start
  4. http://localhost:1978/ -> admin/admin -> create new nodes (xx_test/xx_development/xx_production)
  5. script/plugin install http://github.com/grosser/search_do
  6. add to database.yml (once for every environment):
    estraier:
      host: localhost
      user: admin
      password: admin
      port: 1978
      node: xx_development
  7. >ModelName<.rb: acts_as_searchable :searchable_fields=>[:descr,:title] details
  8. Add all current models to the fulltext search:
    script/console
    >ModelName<.reindex!
  9. Check back in the corresponding node @ http://localhost:1978/ to see if documents have been created
  10. play around with >ModelName<.fulltext_search

Hope this helps :)

more detailed help

8 thoughts on “Getting started with acts_as_searchable on Ubuntu

  1. We love Hyperestraier too and nice to see someone forked the plugin on git and made some changes.

    The plugin could use some more features like multimodel search (preferrably in its own class, so you can call something like Multimodel.search(:models => [...])) and transparent indexing of associated records and I really hope my employer will one day allow me to invest some time in it.

    But when it comes to performance, memory footprint and stability, Hyperestraier really shines.

  2. SomeModel.fulltext_search(‘xxx’,:raw=>true,:all_types=>true)
    will give you all models, the only thing left to you is retrieving the models(iterating over the results and do a results[i] = results[i].attr(‘type’).constantize.find(results[i].attr(‘db_id’))) #pseudocode, may not work…

    the multimodel approach seems appealing too, but atm i am satisfied with the features :)

  3. Thanks for the tutorial. I’ve been trying to get this working on Mac as well for my development machine, but I’m having a ton of problems. I’m using Darwin/Mac ports to install it, but can’t see to get past step 1 after installing it.

  4. Alright, thanks anyways. If you happen to remember it sometime, don’t forget to shoot me an e-mail. ;)

  5. I’ve been using HE and the original acts_as_searchable in a website, but recent changes to how we’re using it has prompted a bit of research.

    I realise this is a bit late, but do you know if HE can use more than one order clause? eg @title STRA, @created_at NUMD (order by title, then by date)

    Or is that sort of thing a problem with plugins?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s