<?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>Binary Logic &#187; v2</title>
	<atom:link href="http://www.binarylogic.com/tag/v2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.binarylogic.com</link>
	<description>Ben Johnson's thoughts and programming techniques</description>
	<lastBuildDate>Sat, 23 Jan 2010 21:19:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Searchlogic v2 officially released</title>
		<link>http://www.binarylogic.com/2009/06/15/searchlogic-v2-officially-released/</link>
		<comments>http://www.binarylogic.com/2009/06/15/searchlogic-v2-officially-released/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 06:14:47 +0000</pubDate>
		<dc:creator>benjohnson</dc:creator>
				<category><![CDATA[Searchlogic]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[v2]]></category>

		<guid isPermaLink="false">http://www.binarylogic.com/?p=768</guid>
		<description><![CDATA[Tonight I went ahead and officially released searchlogic v2. If you didn&#8217;t read my last post, v2 is a complete rewrite of the library. It takes a new approach. It went from ~2300 lines of code to ~400 lines of code. It&#8217;s simpler, easier to use, much more light weight, faster, and more importantly, easier [...]]]></description>
			<content:encoded><![CDATA[<p>Tonight I went ahead and officially released <a href="http://github.com/binarylogic/searchlogic/tree/master">searchlogic v2</a>. If you didn&#8217;t read my last post, v2 is a <em>complete</em> rewrite of the library. It takes a new approach. It went from ~2300 lines of code to ~400 lines of code. It&#8217;s simpler, easier to use, much more light weight, faster, and more importantly, easier to maintain, understand, and improve upon.</p>
<p>I&#8217;m not going to ramble about the changes, because you can read my <a hef="http://www.binarylogic.com/2009/06/09/searchlogic-v2-beta-released/">previous post</a> or you can check out the <a href="http://github.com/binarylogic/searchlogic/tree/master">read me</a> on github.</p>
<h3>Using github not rubyforge</h3>
<p>I have decided to start using github to host my gems, if you want to start using v2 as a gem you need to install the binarylogic-searchlogic gem from the github source. (checkout the <a href="http://github.com/binarylogic/searchlogic/tree/master">read me</a> for easy installation instructions).</p>
<h3>Thank you</h3>
<p>Sorry for such a quick post. I figured this was an important announcement.</p>
<p>Thank you for being patient with v1, I know there were some people having issues. This should address all of them.</p>
<p>As always, I did my best with the <a href="http://github.com/binarylogic/searchlogic/tree/master">readme</a> and the <a href="http://rdoc.info/projects/binarylogic/searchlogic">rdocumentation</a>. If you really want to see what v2 is all about I suggest you take a glance at those, they should be comprehensive.</p>
<p>I hope you enjoy v2, I&#8217;m really excited to release it. I have already integrated it into the app that I am working on, and I love it. It works great and all of my tests pass.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.binarylogic.com/2009/06/15/searchlogic-v2-officially-released/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Searchlogic v2 beta released</title>
		<link>http://www.binarylogic.com/2009/06/09/searchlogic-v2-beta-released/</link>
		<comments>http://www.binarylogic.com/2009/06/09/searchlogic-v2-beta-released/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 04:07:14 +0000</pubDate>
		<dc:creator>benjohnson</dc:creator>
				<category><![CDATA[Searchlogic]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[v2]]></category>

		<guid isPermaLink="false">http://www.binarylogic.com/?p=756</guid>
		<description><![CDATA[Searchlogic v2 beta was released today, it is a complete rewrite of the library, no code was reused. Right now its in a separate branch under the Searchlogic project, and will be merged when it is taken out of beta status. Let me explain how it&#8217;s different.
So, the project I&#8217;m working on now required something [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/binarylogic/searchlogic/tree/v2">Searchlogic v2 beta</a> was released today, it is a <strong>complete</strong> rewrite of the library, no code was reused. Right now its in a separate branch under the <a href="http://github.com/binarylogic/searchlogic/tree/master">Searchlogic project</a>, and will be merged when it is taken out of beta status. Let me explain how it&#8217;s different.</p>
<p>So, the project I&#8217;m working on now required something from Searchlogic v1 that it couldn&#8217;t provide. That is, searching with existing named scopes. I could do this, but it wasn&#8217;t as elegant as it was with the built in conditions (Ex: username_like, etc.).</p>
<h2>The idea behind Searchlogic v2</h2>
<p>So this got me thinking, how can I get Searchlogic v1 to use existing named scopes? That&#8217;s when it hit me, why not use named scopes for everything?<span id="more-756"></span>I think we can all agree named scopes are the heart of searching and breaking up common search logic in your models. Instead of having all of this crazy logic write SQL and chain it together, as in v1, why not have Searchlogic dynamically create these common named scopes for you and then just leverage those? That&#8217;s exactly what v2 does. Instead of going into detail about v2, check out the <a href="http://github.com/binarylogic/searchlogic/tree/v2">current README</a>. It explains everything v2 has to offer up to this point.</p>
<p>The best part about this approach is that it fits nicely into your application. All that it is doing is creating named scopes. More importantly, if you need some condition that Searchlogic doesn&#8217;t offer, no problem, just create your own named scope. This is what you should be doing anyways.</p>
<p>To bring it all home, let me show a simple search form that uses v2. Assume we have</p>
<pre>
User(name:string, age:integer)
Order(user_id:integer, total:float)

User.has_many :orders
User.named_scope :four_year_olds, :conditions => {:age => 4}
User.named_scope :name_sounds_like, lamda { |value| {:conditions => ["name SOUNDS LIKE ?", value]} }
</pre>
<p>Your search form could look like this:</p>
<pre class="ruby">
- form_for @search do |f|
  = f.text_field :name_like
  = f.select :age_greater_than, (1..100)
  = f.text_field :orders_total_less_than
  = f.text_field :name_sounds_like
  = f.check_box :four_year_olds
  = f.submit
</pre>
<p>Notice the use of custom named scopes. Also the other conditions are also named scopes that searchlogic dynamically defines as you need them.</p>
<h2>The best part of v2</h2>
<ul>
<li><strong>V1:</strong> ~2300 lines of code</li>
<li><strong>V2:</strong> ~350 lines of code</li>
</ul>
<p>As you might have saw <a href="http://www.binarylogic.com/2009/04/17/need-some-help-searchlogic-20/">in this post</a> Searchlogic v1 was too big for me to handle. The issues people were having would take way too long to solve and I just didn&#8217;t like the code. The library really wasn&#8217;t advancing and it was just an annoyance. It was regretably the first library I ever wrote, and as such there are a lot of things I would do differently, which should be evident in v2.</p>
<p>That being said, v2 is lean, makes sense, and just feels right. I&#8217;m really looking forward to maintaing the library and seeing where it goes. I hope everyone enjoys it. Let me know what you think. There are just a couple of things left to do before I officially release it.</p>
<h2>Applications using v1</h2>
<p>Lastly, because this is such a big change, backwards compatibility <em>will</em> be broken. Before I officially release the library I will write a document explaining the differences and how to transition. In the mean time, your gem declarations in your application should look like this, so that your app doesn&#8217;t break when the new version is released:</p>
<pre>
 config.gem "searchlogic", :version => "~> 1.6.6"
# the ~ will let you advance minor and tiny versions, but not major versions.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.binarylogic.com/2009/06/09/searchlogic-v2-beta-released/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>
