<?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>SharePointBlog.nl &#187; Search</title>
	<atom:link href="http://www.sharepointblog.nl/tag/search/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sharepointblog.nl</link>
	<description>Michiel Lankamp</description>
	<lastBuildDate>Wed, 26 May 2010 09:37:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>FullTextSqlQuery Exception from HRESULT: 0x80040E60</title>
		<link>http://www.sharepointblog.nl/2010/05/25/fulltextsqlquery-exception-from-hresult-0x80040e60/</link>
		<comments>http://www.sharepointblog.nl/2010/05/25/fulltextsqlquery-exception-from-hresult-0x80040e60/#comments</comments>
		<pubDate>Tue, 25 May 2010 22:09:16 +0000</pubDate>
		<dc:creator>Michiel</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Exception]]></category>
		<category><![CDATA[FullTextSqlQuery]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://www.sharepointblog.nl/?p=52</guid>
		<description><![CDATA[After upgrading a webpart from SharePoint 2007 to 2010 I got a exception from de search engine about the query format. I used the following code: var sqlQuery = new FullTextSqlQuery(SPContext.Current.Site); sqlQuery.ResultTypes = ResultType.RelevantResults; sqlQuery.TrimDuplicates = false; sqlQuery.QueryText = "SELECT Path, Title FROM scope() ORDER BY Title"; // Return the search results to a ResultTableCollection. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2010%2F05%2F25%2Ffulltextsqlquery-exception-from-hresult-0x80040e60%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2010%2F05%2F25%2Ffulltextsqlquery-exception-from-hresult-0x80040e60%2F&amp;source=m_lampje&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>After upgrading a webpart from SharePoint 2007 to 2010 I got a exception from de search engine about the query format. I used the following code:</p>
<pre class="csharpcode">var sqlQuery = <span class="kwrd">new</span> FullTextSqlQuery(SPContext.Current.Site);
sqlQuery.ResultTypes = ResultType.RelevantResults;
sqlQuery.TrimDuplicates = <span class="kwrd">false</span>;
sqlQuery.QueryText = <span class="str">"SELECT Path, Title FROM scope() ORDER BY Title"</span>;

<span class="rem">// Return the search results to a ResultTableCollection.</span>
var results = sqlQuery.Execute();</pre>
<p>When I debugged the code I found out that the ORDER BY clause was causing the problem. When I used a integer or date managed property in the order by clause the problem disappeared. I started investigating the options for text managed properties, in the properties for a managed property I found a new option:</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://www.sharepointblog.nl/wp-content/uploads/2010/05/image1.png" border="0" alt="image" width="499" height="31" /></p>
<p>The explanation for this option is:</p>
<blockquote><p>To reduce storage requirements, new text properties are automatically treated as a hash which limits comparisons <strong>(including sorting</strong>) to equality/inequality.  Unselect this option to enable other types of comparisons (less than, greater than, order by).</p></blockquote>
<p><span style="color: #666666;">When I enabled this option and started a full-crawl the problems are gone. In my opinion the error message should have been a bit more clearer.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointblog.nl/2010/05/25/fulltextsqlquery-exception-from-hresult-0x80040e60/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Customize SearchBoxEx</title>
		<link>http://www.sharepointblog.nl/2007/10/16/customize-searchboxex/</link>
		<comments>http://www.sharepointblog.nl/2007/10/16/customize-searchboxex/#comments</comments>
		<pubDate>Tue, 16 Oct 2007 22:52:54 +0000</pubDate>
		<dc:creator>Michiel</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[SearchBoxEx]]></category>

		<guid isPermaLink="false">http://www.sharepointblog.nl/?p=29</guid>
		<description><![CDATA[A external company made a design for a Internet facing website, in the design the search control was made up in to rows. So my first idea was to create a new controltemplate for the SmallSearchInputBox, but then I realized that in moss the search-control isn&#8217;t a controltemplate anymore (in WSS it is). The searchbox [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2007%2F10%2F16%2Fcustomize-searchboxex%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sharepointblog.nl%2F2007%2F10%2F16%2Fcustomize-searchboxex%2F&amp;source=m_lampje&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>A external company made a design for a Internet facing website, in the design the search control was made up in to rows. So my first idea was to create a new controltemplate for the SmallSearchInputBox, but then I realized that in moss the search-control isn&#8217;t a controltemplate anymore (in WSS it is). The searchbox in MOSS is a control called <a href="http://msdn2.microsoft.com/ms518994.aspx" target="_blank">SearchBoxEx</a>, and this has some properties for the layout of the control. But is always renders the output as a table with 1 row, so my problem was how to render is in 2 rows using divs. Google didn&#8217;t provide me with an answer, so is started coding myself (I don&#8217;t want to create a new control with all logic, I just want reuse all the logic of SearchBoxEx and provide new render logic).</p>
<p>I finally found a way to do this, I just create an new control that inherits from SearchBoxEx. My custom look-and-feel can be done used an override of the CreateChildControls:<br />
<!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode"><span class="kwrd">protected</span> <span class="kwrd">override</span> <span class="kwrd">void</span> CreateChildControls( )
{
    <span class="kwrd">base</span>.CreateChildControls( );

    <span class="kwrd">if</span> ( Controls.Count &lt; 2 )
    {
        <span class="kwrd">return</span>;
    }

    HyperLinkLoc hlink = <span class="kwrd">null</span>;
    <span class="kwrd">if</span> ( Controls[ 1 ].GetType( ) == <span class="kwrd">typeof</span> ( Table ) )
    {
        Table tabel = ( Table ) Controls[ 1 ];

        <span class="rem">// Loop through cells to find the go button</span>
        <span class="kwrd">foreach</span> ( TableCell cell <span class="kwrd">in</span> tabel.Rows[ 0 ].Cells )
        {
            <span class="kwrd">if</span> ( cell.Controls.Count &gt; 0 )
            {
                <span class="kwrd">if</span> ( cell.Controls[ 0 ].GetType( ) == <span class="kwrd">typeof</span> ( HyperLinkLoc ) )
                {
                    hlink = ( HyperLinkLoc ) cell.Controls[ 0 ];
                }
            }
        }
        tabel.Visible = <span class="kwrd">false</span>;</pre>
<p>I first call the base.CreateChildControls to have SearchBoxEx create all the controls based on the properties set. Then I start looping through the tablecells to find the Go-button, the other controls (textbox &amp; dropdownlist) are available as protected members. After the go-button has been found, I set the table to invisible. Now that I have a reference to the controls I can start building my own look-and-feel:<br />
<!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">        <span class="kwrd">if</span> ( m_searchKeyWordTextBox != <span class="kwrd">null</span> )
        {
            HtmlGenericControl div = <span class="kwrd">new</span> HtmlGenericControl( <span class="str">"div"</span> );
            div.Attributes.Add( <span class="str">"class"</span>, <span class="str">"ms-sbcell"</span> );
            m_searchKeyWordTextBox.Style.Clear( ); <span class="rem">// remove the width style, done in css</span>
            div.Controls.Add( m_searchKeyWordTextBox );
            Controls.Add( div );
        }

        <span class="kwrd">if</span> ( hlink != <span class="kwrd">null</span> )
        {
            HtmlGenericControl div3 = <span class="kwrd">new</span> HtmlGenericControl( <span class="str">"div"</span> );
            div3.Attributes.Add( <span class="str">"class"</span>, <span class="str">"ms-sbgo ms-sbcell"</span> );
            div3.Controls.Add( hlink );
            Controls.Add( div3 );
        }

        <span class="kwrd">if</span> ( m_ddlScopes != <span class="kwrd">null</span> )
        {
            HtmlGenericControl div2 = <span class="kwrd">new</span> HtmlGenericControl( <span class="str">"div"</span> );
            div2.Attributes.Add( <span class="str">"class"</span>, <span class="str">"ms-sbscopes ms-sbcell"</span> );
            div2.Controls.Add( m_ddlScopes );
            Controls.Add( div2 );
        }
    }
}</pre>
<p>Download source: <a href="http://www.sharepointblog.nl/wp-content/uploads/2007/10/searchbox.cs" target="_blank">searchbox</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointblog.nl/2007/10/16/customize-searchboxex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
