<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Sphinx Search C# .NET Client API</title>
	<atom:link href="http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/feed/" rel="self" type="application/rss+xml" />
	<link>http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/</link>
	<description>caffeine. music. code. photography.</description>
	<lastBuildDate>Mon, 26 Jul 2010 22:16:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Rusted</title>
		<link>http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/comment-page-1/#comment-1190</link>
		<dc:creator>Rusted</dc:creator>
		<pubDate>Tue, 13 Oct 2009 08:55:03 +0000</pubDate>
		<guid isPermaLink="false">http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/#comment-1190</guid>
		<description>Check this client too http://code.google.com/p/sphinx-dotnet-client/
It&#039;s open source and supports all latest features and Sphinx server protocols,  
ADO.NET like API. Provided with samples and Sphinx GUI index test tool.</description>
		<content:encoded><![CDATA[<p>Check this client too <a href="http://code.google.com/p/sphinx-dotnet-client/" rel="nofollow">http://code.google.com/p/sphinx-dotnet-client/</a><br />
It&#8217;s open source and supports all latest features and Sphinx server protocols,<br />
ADO.NET like API. Provided with samples and Sphinx GUI index test tool.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shaun</title>
		<link>http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/comment-page-1/#comment-1187</link>
		<dc:creator>Shaun</dc:creator>
		<pubDate>Mon, 05 Oct 2009 18:07:46 +0000</pubDate>
		<guid isPermaLink="false">http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/#comment-1187</guid>
		<description>Hey everyone, I re-wrote a .NET client for Sphinx from scratch this past weekend and have posted it up on Google Code (http://code.google.com/p/sphinxdotnet) Feel free to join the project and help out if you want. I think it is feature complete for the sphinxsearch trunk (release 2011)</description>
		<content:encoded><![CDATA[<p>Hey everyone, I re-wrote a .NET client for Sphinx from scratch this past weekend and have posted it up on Google Code (<a href="http://code.google.com/p/sphinxdotnet" rel="nofollow">http://code.google.com/p/sphinxdotnet</a>) Feel free to join the project and help out if you want. I think it is feature complete for the sphinxsearch trunk (release 2011)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/comment-page-1/#comment-1180</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Fri, 28 Aug 2009 21:27:50 +0000</pubDate>
		<guid isPermaLink="false">http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/#comment-1180</guid>
		<description>One more piece:
public void SetFilterFloatRange(string attribute, float min, float max, bool exclude)
        {
		    Debug.Assert ( min&lt;=max, &quot;min must be less or equal to max&quot; );
		    try
		    {
                BinaryWriter bw = new BinaryWriter(_filterStreamData);
                WriteToStream(bw, attribute);
                WriteToStream(bw, SPH_FILTER_FLOATRANGE);
                WriteToStream(bw, min);
                WriteToStream(bw, max);
                WriteToStream(bw, exclude ? 1 : 0);
		    } 
            catch ( Exception e )
		    {
			    Debug.Assert ( false, &quot;IOException: &quot; + e.ToString() );
		    }
		    _filterCount++;
        }</description>
		<content:encoded><![CDATA[<p>One more piece:<br />
public void SetFilterFloatRange(string attribute, float min, float max, bool exclude)<br />
        {<br />
		    Debug.Assert ( min&lt;=max, &#8220;min must be less or equal to max&#8221; );<br />
		    try<br />
		    {<br />
                BinaryWriter bw = new BinaryWriter(_filterStreamData);<br />
                WriteToStream(bw, attribute);<br />
                WriteToStream(bw, SPH_FILTER_FLOATRANGE);<br />
                WriteToStream(bw, min);<br />
                WriteToStream(bw, max);<br />
                WriteToStream(bw, exclude ? 1 : 0);<br />
		    }<br />
            catch ( Exception e )<br />
		    {<br />
			    Debug.Assert ( false, &#8220;IOException: &#8221; + e.ToString() );<br />
		    }<br />
		    _filterCount++;<br />
        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/comment-page-1/#comment-1179</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Fri, 28 Aug 2009 21:01:09 +0000</pubDate>
		<guid isPermaLink="false">http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/#comment-1179</guid>
		<description>Also added UpdateAttributes API Call:

/**
	     * Connect to searchd server and update given attributes on given documents in given indexes.
	     * Sample code that will set group_id=123 where id=1 and group_id=456 where id=3:
	     *
	     * 
	     * String[] attrs = new String[1];
	     *
	     * attrs[0] = &quot;group_id&quot;;
	     * long[][] values = new long[2][2];
	     *
	     * values[0] = new long[2]; values[0][0] = 1; values[0][1] = 123;
	     * values[1] = new long[2]; values[1][0] = 3; values[1][1] = 456;
	     *
	     * int res = cl.UpdateAttributes ( &quot;test1&quot;, attrs, values );
	     * 
	     *
	     * @param index		index name(s) to update; might be distributed
	     * @param attrs		array with the names of the attributes to update
	     * @param values	array of updates; each long[] entry must contains document ID
	     *					in the first element, and all new attribute values in the following ones
	     * @return			-1 on failure, amount of actually found and updated documents (might be 0) on success
	     *
	     * @throws			SphinxException on invalid parameters
	     */
	    public int UpdateAttributes ( String index, String[] attrs, long[][] values )
	    {
		    /* check args */
		    Debug.Assert ( !string.IsNullOrEmpty(index), &quot;no index name provided&quot; );
		    Debug.Assert ( attrs!=null &amp;&amp; attrs.Length&gt;0, &quot;no attribute names provided&quot; );
		    Debug.Assert ( values!=null &amp;&amp; values.Length&gt;0, &quot;no update entries provided&quot; );
		    for ( int i=0; i&lt;values.Length; i++ )
		    {
			    Debug.Assert ( values[i]!=null, &quot;update entry #&quot; + i + &quot; is null&quot; );
			    Debug.Assert ( values[i].Length == 1 + attrs.Length, &quot;update entry #&quot; + i + &quot; has wrong length&quot; );
		    }

		    /* build and send request */
            if (_client == null &#124;&#124; !_client.Connected)
            {
                this.Connect();
            }
            if (_client == null) return -1;
            StreamReader sr = new StreamReader(_client.GetStream());
            BinaryWriter sw = new BinaryWriter(_client.GetStream());
            BinaryWriter tsw = new BinaryWriter(new MemoryStream()); /* temp command buffer */
		    try
		    {
                WriteToStream(sw, VER_MAJOR_PROTO);
                WriteToStream(sw, (short)SEARCHD_COMMAND_UPDATE);
                WriteToStream(sw, (short)VER_COMMAND_UPDATE);
                this.WriteToStream(tsw, index);
                this.WriteToStream(tsw, attrs.Length);
                for (int i = 0; i&lt; attrs.Length; i++)
                {
                    this.WriteToStream(tsw, attrs[i]);
                }

                this.WriteToStream(tsw, values.Length);

                for (int i = 0; i &lt; values.Length; i++)
                {
                    this.WriteToStream(tsw, values[i][0]); /* send docid as 64bit value */
                    for (int j = 1; j &lt; values[i].Length; j++)
                    {
                            this.WriteToStream(tsw, (int)values[i][j]); /* send values as 32bit values; FIXME! what happens when they are over 2^31? */
                    }
                }

                this.WriteToStream(sw, (int)tsw.BaseStream.Length); // send the request size
                sw.Write(((MemoryStream)tsw.BaseStream).ToArray());
                sw.Flush();

		    } catch ( Exception e )
		    {
			    _error = &quot;internal error: failed to build request: &quot; + e;
			    return -1;
		    }

		    /* get and parse response */
		    byte[] response = GetResponse(_client, VER_COMMAND_UPDATE);
            if ( response == null )
			    return -1;

		    try
		    {
                BinaryReader br = new BinaryReader(new MemoryStream(response));
                return this.ReadInt32(br);
		    } catch ( Exception  )
		    {
			    _error = &quot;incomplete reply&quot;;
			    return -1;
		    }
	    }</description>
		<content:encoded><![CDATA[<p>Also added UpdateAttributes API Call:</p>
<p>/**<br />
	     * Connect to searchd server and update given attributes on given documents in given indexes.<br />
	     * Sample code that will set group_id=123 where id=1 and group_id=456 where id=3:<br />
	     *<br />
	     *<br />
	     * String[] attrs = new String[1];<br />
	     *<br />
	     * attrs[0] = &#8220;group_id&#8221;;<br />
	     * long[][] values = new long[2][2];<br />
	     *<br />
	     * values[0] = new long[2]; values[0][0] = 1; values[0][1] = 123;<br />
	     * values[1] = new long[2]; values[1][0] = 3; values[1][1] = 456;<br />
	     *<br />
	     * int res = cl.UpdateAttributes ( &#8220;test1&#8243;, attrs, values );<br />
	     *<br />
	     *<br />
	     * @param index		index name(s) to update; might be distributed<br />
	     * @param attrs		array with the names of the attributes to update<br />
	     * @param values	array of updates; each long[] entry must contains document ID<br />
	     *					in the first element, and all new attribute values in the following ones<br />
	     * @return			-1 on failure, amount of actually found and updated documents (might be 0) on success<br />
	     *<br />
	     * @throws			SphinxException on invalid parameters<br />
	     */<br />
	    public int UpdateAttributes ( String index, String[] attrs, long[][] values )<br />
	    {<br />
		    /* check args */<br />
		    Debug.Assert ( !string.IsNullOrEmpty(index), &#8220;no index name provided&#8221; );<br />
		    Debug.Assert ( attrs!=null &amp;&amp; attrs.Length&gt;0, &#8220;no attribute names provided&#8221; );<br />
		    Debug.Assert ( values!=null &amp;&amp; values.Length&gt;0, &#8220;no update entries provided&#8221; );<br />
		    for ( int i=0; i&lt;values.Length; i++ )<br />
		    {<br />
			    Debug.Assert ( values[i]!=null, &#8220;update entry #&#8221; + i + &#8221; is null&#8221; );<br />
			    Debug.Assert ( values[i].Length == 1 + attrs.Length, &#8220;update entry #&#8221; + i + &#8221; has wrong length&#8221; );<br />
		    }</p>
<p>		    /* build and send request */<br />
            if (_client == null || !_client.Connected)<br />
            {<br />
                this.Connect();<br />
            }<br />
            if (_client == null) return -1;<br />
            StreamReader sr = new StreamReader(_client.GetStream());<br />
            BinaryWriter sw = new BinaryWriter(_client.GetStream());<br />
            BinaryWriter tsw = new BinaryWriter(new MemoryStream()); /* temp command buffer */<br />
		    try<br />
		    {<br />
                WriteToStream(sw, VER_MAJOR_PROTO);<br />
                WriteToStream(sw, (short)SEARCHD_COMMAND_UPDATE);<br />
                WriteToStream(sw, (short)VER_COMMAND_UPDATE);<br />
                this.WriteToStream(tsw, index);<br />
                this.WriteToStream(tsw, attrs.Length);<br />
                for (int i = 0; i&lt; attrs.Length; i++)<br />
                {<br />
                    this.WriteToStream(tsw, attrs[i]);<br />
                }</p>
<p>                this.WriteToStream(tsw, values.Length);</p>
<p>                for (int i = 0; i &lt; values.Length; i++)<br />
                {<br />
                    this.WriteToStream(tsw, values[i][0]); /* send docid as 64bit value */<br />
                    for (int j = 1; j &lt; values[i].Length; j++)<br />
                    {<br />
                            this.WriteToStream(tsw, (int)values[i][j]); /* send values as 32bit values; FIXME! what happens when they are over 2^31? */<br />
                    }<br />
                }</p>
<p>                this.WriteToStream(sw, (int)tsw.BaseStream.Length); // send the request size<br />
                sw.Write(((MemoryStream)tsw.BaseStream).ToArray());<br />
                sw.Flush();</p>
<p>		    } catch ( Exception e )<br />
		    {<br />
			    _error = &#8220;internal error: failed to build request: &#8221; + e;<br />
			    return -1;<br />
		    }</p>
<p>		    /* get and parse response */<br />
		    byte[] response = GetResponse(_client, VER_COMMAND_UPDATE);<br />
            if ( response == null )<br />
			    return -1;</p>
<p>		    try<br />
		    {<br />
                BinaryReader br = new BinaryReader(new MemoryStream(response));<br />
                return this.ReadInt32(br);<br />
		    } catch ( Exception  )<br />
		    {<br />
			    _error = &#8220;incomplete reply&#8221;;<br />
			    return -1;<br />
		    }<br />
	    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/comment-page-1/#comment-1178</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Fri, 28 Aug 2009 20:53:06 +0000</pubDate>
		<guid isPermaLink="false">http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/#comment-1178</guid>
		<description>Added support for floats.  Here&#039;s some code:
private void WriteToStream(BinaryWriter sw, float data)
        {
            int intBits = FloatToInt32Bits(data);
            byte[] d = BitConverter.GetBytes(intBits);
            sw.Write(_Reverse(d));
        }

        public static unsafe int FloatToInt32Bits(float value)
        {
            return *(((int*)&amp;value));
        }

        public static unsafe float Int32FloatToBits(int value)
        {
            return *(((float*)&amp;value));
        }</description>
		<content:encoded><![CDATA[<p>Added support for floats.  Here&#8217;s some code:<br />
private void WriteToStream(BinaryWriter sw, float data)<br />
        {<br />
            int intBits = FloatToInt32Bits(data);<br />
            byte[] d = BitConverter.GetBytes(intBits);<br />
            sw.Write(_Reverse(d));<br />
        }</p>
<p>        public static unsafe int FloatToInt32Bits(float value)<br />
        {<br />
            return *(((int*)&amp;value));<br />
        }</p>
<p>        public static unsafe float Int32FloatToBits(int value)<br />
        {<br />
            return *(((float*)&amp;value));<br />
        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vincent Theeten</title>
		<link>http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/comment-page-1/#comment-1149</link>
		<dc:creator>Vincent Theeten</dc:creator>
		<pubDate>Fri, 24 Jul 2009 10:02:41 +0000</pubDate>
		<guid isPermaLink="false">http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/#comment-1149</guid>
		<description>Great initiative Christoper. Any chance you&#039;ll be putting up a shared project somewhere? Google code? Github? I&#039;m sure others are willing to contribute as well.</description>
		<content:encoded><![CDATA[<p>Great initiative Christoper. Any chance you&#8217;ll be putting up a shared project somewhere? Google code? Github? I&#8217;m sure others are willing to contribute as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zeke</title>
		<link>http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/comment-page-1/#comment-1146</link>
		<dc:creator>Zeke</dc:creator>
		<pubDate>Thu, 09 Jul 2009 05:23:09 +0000</pubDate>
		<guid isPermaLink="false">http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/#comment-1146</guid>
		<description>We are looking for a solution for Sphinx to run on 64bits Windows Server. Any clues? Don&#039;t even mind a fee for a compilation that will work on 64bits windows.</description>
		<content:encoded><![CDATA[<p>We are looking for a solution for Sphinx to run on 64bits Windows Server. Any clues? Don&#8217;t even mind a fee for a compilation that will work on 64bits windows.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charlie</title>
		<link>http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/comment-page-1/#comment-1133</link>
		<dc:creator>Charlie</dc:creator>
		<pubDate>Wed, 01 Jul 2009 04:42:19 +0000</pubDate>
		<guid isPermaLink="false">http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/#comment-1133</guid>
		<description>Maybe my problem is the same to you.
When can the version be published?</description>
		<content:encoded><![CDATA[<p>Maybe my problem is the same to you.<br />
When can the version be published?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charlie</title>
		<link>http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/comment-page-1/#comment-1132</link>
		<dc:creator>Charlie</dc:creator>
		<pubDate>Wed, 01 Jul 2009 04:38:28 +0000</pubDate>
		<guid isPermaLink="false">http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/#comment-1132</guid>
		<description>Hello,sir
There is a problem with getting a match&#039;s attrValues.its always be nothing.
How can I init a match&#039;s attrValues array.</description>
		<content:encoded><![CDATA[<p>Hello,sir<br />
There is a problem with getting a match&#8217;s attrValues.its always be nothing.<br />
How can I init a match&#8217;s attrValues array.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mohit</title>
		<link>http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/comment-page-1/#comment-1124</link>
		<dc:creator>Mohit</dc:creator>
		<pubDate>Wed, 24 Jun 2009 16:40:01 +0000</pubDate>
		<guid isPermaLink="false">http://iterat.ive.ly/index.php/2008/01/05/sphinx-search-c-net-client-api/#comment-1124</guid>
		<description>Hi,

I had change the port according to the server but getting error 
&quot;Connect: Read from socket failed: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.&quot;

Plz help...
and also can you please let me know how we can assure that whichever port i m using is the correct one?.

Thanks
Mohit</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I had change the port according to the server but getting error<br />
&#8220;Connect: Read from socket failed: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.&#8221;</p>
<p>Plz help&#8230;<br />
and also can you please let me know how we can assure that whichever port i m using is the correct one?.</p>
<p>Thanks<br />
Mohit</p>
]]></content:encoded>
	</item>
</channel>
</rss>
