<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vinsol - Leading Ruby on Rails Development and Consulting Firm in India &#187; logical_search</title>
	<atom:link href="http://vinsol.com/blog/category/logical_search/feed/" rel="self" type="application/rss+xml" />
	<link>http://vinsol.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 11 Jan 2012 06:07:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Acts as solr: Logical Search</title>
		<link>http://vinsol.com/blog/2008/04/15/acts-as-solr-logical-search/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=acts-as-solr-logical-search</link>
		<comments>http://vinsol.com/blog/2008/04/15/acts-as-solr-logical-search/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 08:37:00 +0000</pubDate>
		<dc:creator>SUR</dc:creator>
				<category><![CDATA[acts_as_solr]]></category>
		<category><![CDATA[logical_search]]></category>

		<guid isPermaLink="false">http://expressica.com/2008/04/15/acts-as-solr-logical-search/</guid>
		<description><![CDATA[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&#8217;t suggest all the possible implementations of making the complex Logic Gates for searching.
Here I am consolidating various possibilities [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>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&#8217;t suggest all the possible implementations of making the complex Logic Gates for searching.<br />
Here I am consolidating various possibilities of Logical Search&#8230;</p>
<p><b>Find all blogs with category ruby or rails</b></p>
<textarea name="code" class="ruby:nocontrols:nogutter" cols="60" rows="10">

  Blog.find_by_solr("category:rails category:ruby", :operator => :or)

</textarea>
<p>another way</p>
<textarea name="code" class="ruby:nocontrols:nogutter" cols="60" rows="10">
 
 Blog.find_by_solr("category:rails OR category:ruby")

</textarea>
<p><b>Find all blogs with categories ruby and rails</b></p>
<textarea name="code" class="ruby:nocontrols:nogutter" cols="60" rows="10">
  Blog.find_by_solr("category:rails category:ruby", :operator => :and)
</textarea>
<p>another way</p>
<textarea name="code" class="ruby:nocontrols:nogutter" cols="60" rows="10">
  Blog.find_by_solr("category:rails AND category:ruby")
</textarea>
<h3>Grouping for more precision</h3>
<p><font color='red'>NOTE: mind the grouping using parenthesis, you might get unexpected results without proper grouping.</font></p>
<p><b>Find all blogs with categories ruby or rails with author Sur</b></p>
<textarea name="code" class="ruby:nocontrols:nogutter" cols="60" rows="10">
  Blog.find_by_solr("(category:rails OR category:ruby) author:sur")
</textarea>
<p><b>Find all blogs with categories ruby AND rails with author Sur</b></p>
<textarea name="code" class="ruby:nocontrols:nogutter" cols="60" rows="10">
  Blog.find_by_solr("(category:rails AND category:ruby) author:sur")
</textarea>
<p><b>Find all blogs with categories ruby or rails with author Sur or David</b></p>
<textarea name="code" class="ruby:nocontrols:nogutter" cols="60" rows="10">
  Blog.find_by_solr("(category:rails OR category:ruby) (author:sur OR author:David)")
</textarea>
<p><b>Find all blogs with categories ruby and rails with author Sur or David</b></p>
<textarea name="code" class="ruby:nocontrols:nogutter" cols="60" rows="10">
  Blog.find_by_solr("(category:rails AND category:ruby) (author:sur OR author:David)")
</textarea>
]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2008/04/15/acts-as-solr-logical-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

