<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Using Sphinx search engine in Ruby on Rails</title>
	<atom:link href="http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/</link>
	<description>In my blog I'll try to describe about interesting technologies, my discovery in IT and some useful things about programming.</description>
	<pubDate>Fri, 29 Aug 2008 07:47:12 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Brad Folkens</title>
		<link>http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-95277</link>
		<dc:creator>Brad Folkens</dc:creator>
		<pubDate>Tue, 30 Nov 2004 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/projects/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-95277</guid>
		<description>

&lt;code lang="diff"&gt;
Index: vendor/plugins/sphinx/lib/client.rb
===================================================================
--- vendor/plugins/sphinx/lib/client.rb (revision 5885)
+++ vendor/plugins/sphinx/lib/client.rb (working copy)
@@ -391,18 +391,20 @@
       count = response[p, 4].unpack('N*').first; p += 4
       
       # read matches
-      result['matches'] = {}
+      result['matches'] = []
       while count &gt; 0 and p &lt; max
         count -= 1
         doc, weight = response[p, 8].unpack('N*N*'); p += 8
   
-        result['matches'][doc] &#124;&#124;= {}
-        result['matches'][doc]['weight'] = weight
+        doc_data = {}
+        doc_data['weight'] = weight
         attrs_names_in_order.each do &#124;attr&#124;
           val = response[p, 4].unpack('N*').first; p += 4
-          result['matches'][doc]['attrs'] &#124;&#124;= {}
-          result['matches'][doc]['attrs'][attr] = val
+          doc_data['attrs'] &#124;&#124;= {}
+          doc_data['attrs'][attr] = val
         end
+        
+        result['matches'] &lt;&lt; [doc, doc_data]
       end
       result['total'], result['total_found'], msecs, words = response[p, 16].unpack('N*N*N*N*'); p += 16
       result['time'] = '%.3f' % (msecs / 1000.0)
&lt;/code&gt;

</description>
		<content:encoded><![CDATA[<div class="codecolorer-container diff" style="height:280px;"><div class="codecolorer" style="font-family: monospace;">Index: vendor/plugins/sphinx/lib/client.rb<br />
===================================================================<br />
<span class="re3">--- vendor/plugins/sphinx/lib/client.rb <span class="br0">&#40;</span>revision <span class="nu0">5885</span><span class="br0">&#41;</span></span><br />
<span class="re4">+++ vendor/plugins/sphinx/lib/client.rb <span class="br0">&#40;</span>working copy<span class="br0">&#41;</span></span><br />
<span class="re6">@@ <span class="nu0">-391</span>,<span class="nu0">18</span> <span class="nu0">+391</span>,<span class="nu0">20</span> @@</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;count = response<span class="br0">&#91;</span>p, <span class="nu0">4</span><span class="br0">&#93;</span>.unpack<span class="br0">&#40;</span>'N*'<span class="br0">&#41;</span>.first; p += <span class="nu0">4</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;# read matches<br />
<span class="re7">-&nbsp; &nbsp; &nbsp; result<span class="br0">&#91;</span>'matches'<span class="br0">&#93;</span> = <span class="br0">&#123;</span><span class="br0">&#125;</span></span><br />
<span class="re8">+&nbsp; &nbsp; &nbsp; result<span class="br0">&#91;</span>'matches'<span class="br0">&#93;</span> = <span class="br0">&#91;</span><span class="br0">&#93;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp;while count &gt; <span class="nu0">0</span> and p &lt; max<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;count -= <span class="nu0">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;doc, weight = response<span class="br0">&#91;</span>p, <span class="nu0">8</span><span class="br0">&#93;</span>.unpack<span class="br0">&#40;</span>'N*N*'<span class="br0">&#41;</span>; p += <span class="nu0">8</span><br />
&nbsp; &nbsp;<br />
<span class="re7">-&nbsp; &nbsp; &nbsp; &nbsp; result<span class="br0">&#91;</span>'matches'<span class="br0">&#93;</span><span class="br0">&#91;</span>doc<span class="br0">&#93;</span> ||= <span class="br0">&#123;</span><span class="br0">&#125;</span></span><br />
<span class="re7">-&nbsp; &nbsp; &nbsp; &nbsp; result<span class="br0">&#91;</span>'matches'<span class="br0">&#93;</span><span class="br0">&#91;</span>doc<span class="br0">&#93;</span><span class="br0">&#91;</span>'weight'<span class="br0">&#93;</span> = weight</span><br />
<span class="re8">+&nbsp; &nbsp; &nbsp; &nbsp; doc_data = <span class="br0">&#123;</span><span class="br0">&#125;</span></span><br />
<span class="re8">+&nbsp; &nbsp; &nbsp; &nbsp; doc_data<span class="br0">&#91;</span>'weight'<span class="br0">&#93;</span> = weight</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;attrs_names_in_order.each do |attr|<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;val = response<span class="br0">&#91;</span>p, <span class="nu0">4</span><span class="br0">&#93;</span>.unpack<span class="br0">&#40;</span>'N*'<span class="br0">&#41;</span>.first; p += <span class="nu0">4</span><br />
<span class="re7">-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result<span class="br0">&#91;</span>'matches'<span class="br0">&#93;</span><span class="br0">&#91;</span>doc<span class="br0">&#93;</span><span class="br0">&#91;</span>'attrs'<span class="br0">&#93;</span> ||= <span class="br0">&#123;</span><span class="br0">&#125;</span></span><br />
<span class="re7">-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result<span class="br0">&#91;</span>'matches'<span class="br0">&#93;</span><span class="br0">&#91;</span>doc<span class="br0">&#93;</span><span class="br0">&#91;</span>'attrs'<span class="br0">&#93;</span><span class="br0">&#91;</span>attr<span class="br0">&#93;</span> = val</span><br />
<span class="re8">+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; doc_data<span class="br0">&#91;</span>'attrs'<span class="br0">&#93;</span> ||= <span class="br0">&#123;</span><span class="br0">&#125;</span></span><br />
<span class="re8">+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; doc_data<span class="br0">&#91;</span>'attrs'<span class="br0">&#93;</span><span class="br0">&#91;</span>attr<span class="br0">&#93;</span> = val</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end<br />
<span class="re8">+&nbsp; &nbsp; &nbsp; &nbsp; </span><br />
<span class="re8">+&nbsp; &nbsp; &nbsp; &nbsp; result<span class="br0">&#91;</span>'matches'<span class="br0">&#93;</span> &lt;&lt; <span class="br0">&#91;</span>doc, doc_data<span class="br0">&#93;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp;end<br />
&nbsp; &nbsp; &nbsp; &nbsp;result<span class="br0">&#91;</span>'total'<span class="br0">&#93;</span>, result<span class="br0">&#91;</span>'total_found'<span class="br0">&#93;</span>, msecs, words = response<span class="br0">&#91;</span>p, <span class="nu0">16</span><span class="br0">&#93;</span>.unpack<span class="br0">&#40;</span>'N*N*N*N*'<span class="br0">&#41;</span>; p += <span class="nu0">16</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;result<span class="br0">&#91;</span>'time'<span class="br0">&#93;</span> = '%.3f' % <span class="br0">&#40;</span>msecs / <span class="nu0">1000.0</span><span class="br0">&#41;</span></div></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: *oytss &#187; Blog Archive &#187; what a ruby (三)</title>
		<link>http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-48134</link>
		<dc:creator>*oytss &#187; Blog Archive &#187; what a ruby (三)</dc:creator>
		<pubDate>Tue, 30 Nov 2004 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/projects/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-48134</guid>
		<description>[...] ActiveSearch Spinx indexed_search_engine SearchGenerator 一整個generator 另外,也可以做成Ajax real-time [...]</description>
		<content:encoded><![CDATA[<p>[...] ActiveSearch Spinx indexed_search_engine SearchGenerator 一整個generator 另外,也可以做成Ajax real-time [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmytro Shteflyuk</title>
		<link>http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-32945</link>
		<dc:creator>Dmytro Shteflyuk</dc:creator>
		<pubDate>Thu, 30 Nov 2006 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/projects/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-32945</guid>
		<description>joost, do you use &lt;tt&gt;set_filter_range&lt;/tt&gt; in your code? Could you show me values you have sent to this method? Also it would be great, if you &lt;a href="http://kpumuk.info/contact/" rel="nofollow"&gt;contact me directly&lt;/a&gt; to fix it quickly.

I'm updating API now and will upload it in next few days.</description>
		<content:encoded><![CDATA[<p>joost, do you use <tt>set_filter_range</tt> in your code? Could you show me values you have sent to this method? Also it would be great, if you <a href="http://kpumuk.info/contact/" rel="nofollow">contact me directly</a> to fix it quickly.</p>
<p>I&#8217;m updating API now and will upload it in next few days.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joost</title>
		<link>http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-32941</link>
		<dc:creator>joost</dc:creator>
		<pubDate>Wed, 30 Nov 2005 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/projects/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-32941</guid>
		<description>Currently I get the following error using the plugin (with v0.9.7 of Sphinx). All database fields are MySQL INT(11).

[cc lang="text"]
../config/../vendor/plugins/sphinx/lib/sphinx.rb:256:in 'pack': bignum too big to convert into 'unsigned long' (RangeError)
        from ../config/../vendor/plugins/sphinx/lib/sphinx.rb:256:in 'query'
        from ../config/../vendor/plugins/sphinx/lib/sphinx.rb:253:in 'each'
        from ../config/../vendor/plugins/sphinx/lib/sphinx.rb:253:in 'query'
        from ./test.rb:136:in 'search_entry'
        from ./test.rb:149
[/cc]

Any idea? Please let me know.. Also about an update!! :)</description>
		<content:encoded><![CDATA[<p>Currently I get the following error using the plugin (with v0.9.7 of Sphinx). All database fields are MySQL INT(11).</p>
<div class="codecolorer-container text">../config/../vendor/plugins/sphinx/lib/sphinx.rb:256:in 'pack': bignum too big to convert into 'unsigned long' (RangeError)
        from ../config/../vendor/plugins/sphinx/lib/sphinx.rb:256:in 'query'
        from ../config/../vendor/plugins/sphinx/lib/sphinx.rb:253:in 'each'
        from ../config/../vendor/plugins/sphinx/lib/sphinx.rb:253:in 'query'
        from ./test.rb:136:in 'search_entry'
        from ./test.rb:149</div>
<p>Any idea? Please let me know.. Also about an update!! <img src='http://kpumuk.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmytro Shteflyuk</title>
		<link>http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-31521</link>
		<dc:creator>Dmytro Shteflyuk</dc:creator>
		<pubDate>Tue, 30 Nov 2004 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/projects/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-31521</guid>
		<description>Update would be published tomorrow or the day after tomorrow. Currently I'm finishing RSpec tests which would cover whole functionality.</description>
		<content:encoded><![CDATA[<p>Update would be published tomorrow or the day after tomorrow. Currently I&#8217;m finishing RSpec tests which would cover whole functionality.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joost</title>
		<link>http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-31507</link>
		<dc:creator>joost</dc:creator>
		<pubDate>Sun, 30 Nov 2003 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/projects/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-31507</guid>
		<description>BTW, is there already an update?? Which includes the above fixes? This would be great!</description>
		<content:encoded><![CDATA[<p>BTW, is there already an update?? Which includes the above fixes? This would be great!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joost</title>
		<link>http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-31506</link>
		<dc:creator>joost</dc:creator>
		<pubDate>Sun, 30 Nov 2003 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/projects/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-31506</guid>
		<description>thx! :)</description>
		<content:encoded><![CDATA[<p>thx! <img src='http://kpumuk.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmytro Shteflyuk</title>
		<link>http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-29749</link>
		<dc:creator>Dmytro Shteflyuk</dc:creator>
		<pubDate>Fri, 30 Nov 2001 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/projects/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-29749</guid>
		<description>Thanks for the tip, Akhil</description>
		<content:encoded><![CDATA[<p>Thanks for the tip, Akhil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Akhil Bansal</title>
		<link>http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-29748</link>
		<dc:creator>Akhil Bansal</dc:creator>
		<pubDate>Fri, 30 Nov 2001 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/projects/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-29748</guid>
		<description>Hi,
I have used fullsearch feature in many of my projects. I have used ferret and hyperestraier. You can use acts_as_ferret for ferret searching and acts_as_searchable for hyperestraier. Ferret provides multiple model search and   other does'nt. I prefer hyperestraier for fulltext search. :)</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I have used fullsearch feature in many of my projects. I have used ferret and hyperestraier. You can use acts_as_ferret for ferret searching and acts_as_searchable for hyperestraier. Ferret provides multiple model search and   other does&#8217;nt. I prefer hyperestraier for fulltext search. <img src='http://kpumuk.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikolay Karev</title>
		<link>http://kpumuk.info/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-25672</link>
		<dc:creator>Nikolay Karev</dc:creator>
		<pubDate>Mon, 30 Nov 2009 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/projects/ror-plugins/using-sphinx-search-engine-in-ruby-on-rails/#comment-25672</guid>
		<description>вот этот кусок кода потенциально проблеммный:
[cc lang="ruby"]
posts = Post.find :all, :conditions =&gt; "id IN (#{ids})"
[/cc]
Если &lt;tt&gt;ids&lt;/tt&gt; содержит несколько тысяч результатов, то есть вероятность что сдохнет парсер запросов в СУБД. И всё очень мрачно упадёт.
Так что имхо лучше сделать или ограничение на количество результатов от sphinx или разбивать их на блоки и уже поблочно вытаскивать из СУБД.</description>
		<content:encoded><![CDATA[<p>вот этот кусок кода потенциально проблеммный:</p>
<div class="codecolorer-container ruby" style="height:35px;"><div class="codecolorer" style="font-family: monospace;">posts = Post.<span class="me1">find</span> <span class="re3">:all</span>, <span class="re3">:conditions</span> =&gt; <span class="st0">&quot;id IN (#{ids})&quot;</span></div></div>
<p>Если <tt>ids</tt> содержит несколько тысяч результатов, то есть вероятность что сдохнет парсер запросов в СУБД. И всё очень мрачно упадёт.<br />
Так что имхо лучше сделать или ограничение на количество результатов от sphinx или разбивать их на блоки и уже поблочно вытаскивать из СУБД.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
