15 Apr 2008

Acts as solr: Logical Search

acts_as_solr, logical_search posted by SUR

There are a couple of ways described in acts_as_solr documentation for the logical search, with AND or OR operations. But I needed to dig a bit into the code as the documentation is not complete and doesn’t suggest all the possible implementations of making the complex Logic Gates for searching.
Here I am consolidating various possibilities of Logical Search…

Find all blogs with category ruby or rails

another way

Find all blogs with categories ruby and rails

another way

Grouping for more precision

NOTE: mind the grouping using parenthesis, you might get unexpected results without proper grouping.

Find all blogs with categories ruby or rails with author Sur

Find all blogs with categories ruby AND rails with author Sur

Find all blogs with categories ruby or rails with author Sur or David

Find all blogs with categories ruby and rails with author Sur or David

13 Sep 2007

Acts_as_solr: Starting solr server on windows

RubyonRails, Technology, acts_as_solr, rails, rails plugins, ruby, solr posted by Akhil Bansal

I was using acts_as_searchable for one of my project, which uses Hyperestraier in background. Yesterday I decided to use acts_as_solr which uses solr(based on Lucene Java search library). I did all written in its Manual/Readme, but when I issued

to start the solr server, it threw a heart breaking “Bad file descriptor” error, although acts_as_solr was working fine on one of my colleague’s linux machine.

I started digging around this and found that there is an issue in rake task that starts the solr server. Actually the problem was this rake task uses ‘fork’ which is not available on windows, also it only handles ‘ECONNREFUSED’ exception which is actually “Connection Refused” error raised by ruby on linux. But in windown it throws ‘EBADF’ which is “Bad file descriptor” error raised by ruby on windows.

So below is the hack for that:

Just add this to vendor/plugins/acts_as_solr/lib/taks/solr.rake, and start solr server on windows by issuing