title: How to programmatically search sharepoint 2010 for sites and folders?
body: <p>Searching for sites and folders on SP2007 server works but not for SP2010. I've tried different settings in content administration (as found on some forums), but then too it doesn't work for SP2010. Tried some change with the embedded SQL query too, didn't help.</p>
  
  <p>NOTE: Search query schema has been changed in SP2010.</p>
  
  <p>Following query string I'm sending:</p>
  
  <pre><code>"&lt;QueryPacket xmlns=\"urn:Microsoft.Search.Query\"&gt;"
      "&lt;Query&gt;"
      "    &lt;SupportedFormats&gt;&lt;Format&gt;urn:Microsoft.Search.Response.Document:Document&lt;/Format&gt;&lt;/SupportedFormats&gt;"
      "    &lt;Context&gt;"
      "        &lt;QueryText type=\"MSSQLFT\" language=\"en-us\"&gt;"
      "           SELECT Path, Title, contentClass, SiteName"
      "           FROM SCOPE()"
      "           WHERE (FREETEXT(Title, '%s') OR FREETEXT(Path, '%s')) AND"
      "                 (contentclass = 'STS_Web' OR"
      "                  contentclass = 'STS_ListItem_DocumentLibrary' OR"
      "                  contentclass = 'STS_List_DocumentLibrary' OR"
      "                  contentclass = 'STS_ListItem_PictureLibrary' OR"
      "                  contentclass = 'STS_List_PictureLibrary') AND"
      "                 (IsDocument != 1) AND"
      "                 (Path NOT LIKE '%%DispForm%%') AND"
      "                 (CONTAINS(Path, '%s'))"
      "           ORDER BY Rank"
      "    &lt;/QueryText&gt;"
      "    &lt;/Context&gt;"
      "    &lt;Range&gt;&lt;StartAt&gt;1&lt;/StartAt&gt;&lt;Count&gt;100&lt;/Count&gt;&lt;/Range&gt;"
      "    &lt;ImplicitAndBehavior&gt;true&lt;/ImplicitAndBehavior&gt;"
      "    &lt;EnableStemming&gt;true&lt;/EnableStemming&gt;"
      "    &lt;TrimDuplicates&gt;true&lt;/TrimDuplicates&gt;"
      "    &lt;IncludeSpecialTermResults&gt;true&lt;/IncludeSpecialTermResults&gt;"
      "    &lt;IgnoreAllNoiseQuery&gt;true&lt;/IgnoreAllNoiseQuery&gt;"
      "    &lt;IncludeRelevanceResults&gt;true&lt;/IncludeRelevanceResults&gt;"       
      "    &lt;IncludeHighConfidenceResults&gt;true&lt;/IncludeHighConfidenceResults&gt;"
      "&lt;/Query&gt;"
      "&lt;/QueryPacket&gt;"
  </code></pre>
  
  <p>Any ideas/links/suggestions?</p>