{"id":919,"date":"2010-12-10T09:10:49","date_gmt":"2010-12-10T08:10:49","guid":{"rendered":"http:\/\/www.itidea.nl\/?p=919"},"modified":"2015-09-08T20:34:15","modified_gmt":"2015-09-08T18:34:15","slug":"sharepoint-2007-author-search-refiner","status":"publish","type":"post","link":"https:\/\/www.itidea.nl\/index.php\/sharepoint-2007-author-search-refiner\/","title":{"rendered":"SharePoint 2007 Author search refiner"},"content":{"rendered":"<p>SharePoint 2010 has a lot of nice features. One of them are search refiners. The search results can be narrowed down by Result Type, Site, Author, Modified Date, etc.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-936\" title=\"SearchSP2010Refiner\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchSP2010Refiner.png\" alt=\"\" width=\"112\" height=\"157\" \/><\/p>\n<p>When knowing and seen that feature I\u2019m really disappointed SharePoint 2007 doesn\u2019t has this. Ok, the Advanced Search page is available, but it\u2019s by far not that easy to use as the search refiners in SharePoint 2010.\u00a0<\/p>\n<p>Another thing popped up into my mind when using the SharePoint 2010 search refiners. Why can\u2019t I select for example multiple authors? Not all, not one, but two or three or whatever I like at that moment with that search action.\u00a0<\/p>\n<h3>Purpose\u00a0<\/h3>\n<p>These two things:\u00a0Search refiner in SharePoint 2007 and the possibility to select more than one item<br \/>\nare the starting point of this post.<\/p>\n<p>One other thing: I like SPServices and jQuery, so I\u2019m going to try to use these techniques instead of a farm solution.<\/p>\n<p>So let\u2019s create a search refiner on authors in this post. When the user performs a search and the results are displayed the option to select one or more authors to narrow down\u00a0the search results will be available. All the different authors are displayed with a checkbox to select one or more and narrow down the search results accordingly.<\/p>\n<p>While writing this post a lot of explaining has to be done so I decided to show it first. After that I\u2019ll explain how to get there.<\/p>\n<h3>See it in action\u00a0<\/h3>\n<p>User types a search text<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchUserText.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-937\" title=\"SearchUserText\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchUserText.png\" alt=\"\" width=\"410\" height=\"33\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchUserText.png 410w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchUserText-300x24.png 300w\" sizes=\"auto, (max-width: 410px) 100vw, 410px\" \/><\/a><\/p>\n<p>The results are displayed<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchResults1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-941\" title=\"SearchResults\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchResults1.png\" alt=\"\" width=\"498\" height=\"593\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchResults1.png 498w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchResults1-251x300.png 251w\" sizes=\"auto, (max-width: 498px) 100vw, 498px\" \/><\/a><br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchResults1.png\"><\/a><\/p>\n<p>The unique authors are listed, the user selects one<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchAuthorRefiner.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-932\" title=\"SearchAuthorRefiner\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchAuthorRefiner.png\" alt=\"\" width=\"196\" height=\"110\" \/><\/a><\/p>\n<p>Search results based on the author selection and the initial search text:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchNarrowedByAuthor.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-933\" title=\"SearchNarrowedByAuthor\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchNarrowedByAuthor.png\" alt=\"\" width=\"510\" height=\"299\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchNarrowedByAuthor.png 510w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchNarrowedByAuthor-300x175.png 300w\" sizes=\"auto, (max-width: 510px) 100vw, 510px\" \/><\/a><\/p>\n<p>Now you know what it does, let me explain it.\u00a0<\/p>\n<h3>Analyzing the search\u00a0<\/h3>\n<p>When a user types his search text in the standard search box, SharePoint 2007 performs a search by encoding the query and posting it to the results page. That\u2019s basically just it, a basic query.<\/p>\n<p>The Advanced Search page uses SQL syntax and can contain almost every query and result one can possibly imagine. For the purpose in this post we have to use the SQL syntax.<\/p>\n<p>The next step is to analyze the Advanced Search box webpart and how a search is performed.<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchAdvancedSearchWebpart.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-931\" title=\"SearchAdvancedSearchWebpart\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchAdvancedSearchWebpart.png\" alt=\"\" width=\"772\" height=\"382\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchAdvancedSearchWebpart.png 772w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchAdvancedSearchWebpart-300x148.png 300w\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" \/><\/a><\/p>\n<p>By typing a search string in the \u2018All of these words\u2019 box and performing the search, the results are displayed. When analyzing the source of this page the SQL query can be found.<br \/>\nSearching on the word \u2018item\u2019 and the property \u2018Author Contains anita\u2019 results in the following SQL query (removed the encoding):<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT WorkId, Rank, Title, Author, Size, Path, Description, Write, SiteName, CollapsingStatus, HitHighlightedSummary, HitHighlightedProperties, ContentClass, IsDocument, PictureThumbnailURL\u00a0 from scope() where freetext(defaultproperties, \u2018+item\u2019) And (Author like \u2018%anita%\u2019) Order By Rank desc\r\n<\/pre>\n<p>How does SharePoint know how to format the query like this? How does it know to put \u2018item\u2019 and the author search in the right place of the query?<\/p>\n<p>With the help of the IE Developer toolbar:<br \/>\n\u2018All of these words\u2019 has the name ASB_TQS_AndQ_tb.<br \/>\nThe first \u2018(Pick property)\u2019 has the name ASB_PS_plb_0, the operator ASB_PS_olb_0 and the value ASB_PS_pvtb_0. The number at the end of the name will increase when multiple properties are used.\u00a0 For the second property the names ending with _1 are used. The And Or operator when using multiple properties is called ASB_PS_lolb_0 and increases when more than two properties are used. These names are used to make up the SQL query.<\/p>\n<p>There are more controls on this page but only the ones mentioned above will be used in this example.<\/p>\n<h3>The code\u00a0<\/h3>\n<p>To perform the right search, the SQL syntax will be used the way the Advanced Search webpart is using it by using html controls with the same names mentioned above.\u00a0<\/p>\n<h4>Getting the authors\u00a0<\/h4>\n<p>When the user performs a search, the results are displayed. The get all the authors of these search results to display the names in a checkbox label later on, the operation QueryEx of the SPServices library is used.\u00a0<\/p>\n<p>First the query is set up:\u00a0<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar queryTextSQL = &quot;&lt;QueryPacket xmlns='urn:Microsoft.Search.Query' Revision='1000'&gt;&quot;\r\nqueryTextSQL += &quot;&lt;Query&gt;&quot;\r\nqueryTextSQL += &quot;&lt;Context&gt;&quot;\r\nqueryTextSQL += &quot;&lt;QueryText language='en-US' type='MSSQLFT'&gt;&quot;\r\n\/\/use the same scope (Advanced Search)\r\nqueryTextSQL += &quot;SELECT Title, Rank, Size, Description, Write, Path, Author FROM scope() WHERE FREETEXT (DEFAULTPROPERTIES, '+&quot; + sessvars.searchValue + &quot;') ORDER BY \\&quot;Rank\\&quot; DESC&quot;\r\nqueryTextSQL += &quot;&lt;\/QueryText&gt;&quot;\r\nqueryTextSQL += &quot;&lt;\/Context&gt;&quot;\r\nqueryTextSQL += &quot;&lt;\/Query&gt;&quot;\r\nqueryTextSQL += &quot;&lt;\/QueryPacket&gt;&quot;;\r\n<\/pre>\n<p>To use the SQL syntax the type attribute is set to MSSQLFT.<br \/>\nThe sessvars.searchValue is filled with the initial search text which the user typed in the search box.\u00a0 Sessions variables without cookies are used here. More information can be found here: <a href=\"http:\/\/www.thomasfrank.se\/sessionvars.html\">http:\/\/www.thomasfrank.se\/sessionvars.html<\/a>\u00a0<\/p>\n<p>After performing a search this search text is displayed in the querystring of the url.<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchQueryStringParameter.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-934\" title=\"SearchQueryStringParameter\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2010\/12\/SearchQueryStringParameter.png\" alt=\"\" width=\"144\" height=\"24\" \/><\/a><\/p>\n<p>In code it is stored in a variable using $().SPServices.SPGetQueryString() with the following code:\u00a0<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nvar queryStringVals = $().SPServices.SPGetQueryString();\r\nvar searchItem = queryStringVals&#x5B;&quot;k&quot;];\r\n<\/pre>\n<p>This value is needed to get it into the SQL query and to put it back in the search box after performing the search. As you know when performing a \u2018regular\u2019 advanced search query, the search text is gone and not displayed in the search box anymore. To prevent \u2018losing\u2019 the user who performed the search the value will be put back in the search box.\u00a0<\/p>\n<p>After setting up the query let\u2019s get the unique authors for the results:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\u00a0\u00a0\u00a0 $().SPServices({\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 operation: &quot;QueryEx&quot;,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 queryXml: queryTextSQL,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 completefunc: function(xData, Status) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 k=0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $(xData.responseXML).find(&quot;RelevantResults&quot;).each(function() {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $(this).find(&quot;AUTHOR&quot;).each(function() {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 authors&#x5B;k]=$(this).text();\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 k++;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 });\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 });\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(authors.length &gt; 0)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0authors = $.unique(authors);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CreateCheckboxes(authors, &quot;Author&quot;, &quot;Contains&quot;);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0 });\r\n<\/pre>\n<p>The code fires the query and gets the authors from the results. The CreateCheckboxes method will create all the necessary controls and will be explained in the next part.\u00a0<\/p>\n<h4>The controls<\/h4>\n<p>In this example an author search refiner will be built where a <em>name of an author<\/em> is the <em>value<\/em> in the query. To accomplish this, the control (using a checkbox in this example) which displays a single author has to have the name ASB_PS_pvtb_0, the next author ASB_PS_pvtb_1, etc.\u00a0<\/p>\n<p>The other names of controls which have to be used are ASB_PS_plb_x (x starting at 0) to set the property name and ASB_PS_olb_x as the operator. Authors are used here, so ASB_PS_plb_x has always the value \u2018AUTHOR\u2019 and the operator has always the value \u2018Or\u2019 since an item can have one author at the same time. These two controls are hidden controls, since these controls are of no use to the user. Only the checkboxes are displayed.\u00a0<\/p>\n<p>The CreateCheckboxes method will set this up for each individual author:\u00a0<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\u00a0\u00a0\u00a0 function CreateCheckboxes(authors, propertyName, operator)\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var authorContainer= $('#someElementId');\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var j=1;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $.each(authors, function( iteration, item )\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/add or statement\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(j==1)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/&lt;input value=&quot;Or&quot; \/&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 authorContainer.append(\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $(document.createElement(&quot;div&quot;))\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .append(\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 createHiddenNamedElement(&quot;input&quot;,&quot;nameprefix$ASB_PS_lolb_&quot; + (j-1), &quot;Or&quot;)\r\n\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 authorContainer.append(\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $(document.createElement(&quot;div&quot;))\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .append(\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $(document.createElement(&quot;input&quot;)).attr({\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 type:\u00a0 'checkbox'\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,name: 'nameprefix$ASB_PS_pvtb_' + j\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  ,id:\u00a0\u00a0\u00a0 'author_' + item\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,value: item\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 })\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .click( function( event )\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  var cbox = $(this)&#x5B;0];\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(cbox.checked)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/remember selected checkboxes to put back after postback\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 sessvars&#x5B;'numberOfAuthorsSelected']++;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 sessvars&#x5B;'numberOfAuthorsSelected' + sessvars&#x5B;'numberOfAuthorsSelected']] = escape(cbox.value);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 else{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/remember only the selected items\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var total = sessvars&#x5B;'numberOfAuthorsSelected'];\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 sessvars&#x5B;'numberOfAuthorsSelected']=0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for(var i=1;i&lt;=total;i++)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(sessvars&#x5B;'numberOfAuthorsSelected' + i] != escape(cbox.value))\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sessvars&#x5B;'numberOfAuthorsSelected']++;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 sessvars&#x5B;'numberOfAuthorsSelected' + sessvars&#x5B;'numberOfAuthorsSelected']] = sessvars&#x5B;'numberOfAuthorsSelected' + i];\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } )\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .append(\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$(document.createElement('label')).attr({\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 'for':\u00a0 'author_' + item\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0})\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.text( item )\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/add hidden input values\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .append(\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 createHiddenNamedElement(&quot;input&quot;,&quot;nameprefix$ASB_PS_plb_&quot; + j, propertyName)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .append(\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 createHiddenNamedElement(&quot;input&quot;,&quot;nameprefix$ASB_PS_olb_&quot; + j, operator)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 j++;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } );\r\n\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0SetSelection();\r\n\u00a0\u00a0\u00a0 }\r\n<\/pre>\n<p>First the operator \u2018Or\u2019 is created. After that, the author checkboxes are created. In the click event the tracking of selecting and unselecting the checkboxes is performed. Then the label is set for the checkbox and last the hidden controls are created to store the property name and the operator.<br \/>\nAt last the SetSelection() method will be called. This method just selects the appropriate checkboxes based on the stored values.\ufffd<br \/>\nTo perform the actual search a search button is needed:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;input onclick='WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;nameprefix$ASB_BS_SRCH_1&quot;, &quot;&quot;, false, &quot;&quot;, &quot;results.aspx&quot;, false, false))' type=&quot;submit&quot; value=&quot;Search&quot; \/&gt;\r\n<\/pre>\n<p>The url has to be set to the current page so the results, according to the selected authors and the search text provided, are displayed in the search results webpart on the same page.\u00a0<\/p>\n<h4>One last important issue<\/h4>\n<p>All properties are treated as numbers by default. When performing a search with the code created right now, an error will occur when selecting an author and perform the search:<br \/>\n\u2018<strong>Invalide parameter: Author. Expect a number. ITIDEA\\anita.boerboom is given instead<\/strong>.\u2019\u00a0<\/p>\n<p>To tell SharePoint to treat the Author property like text the following control has to be added to the page with the name ASB_TextDT_Props :<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;input type=&quot;hidden&quot; name=&quot;ASB_TextDT_Props&quot; id=&quot;Hidden4&quot; value=&quot;Author&quot; \/&gt;\r\n\r\n<\/pre>\n<p>When multiple properties have to be treated like text the values can be separated by #;#, e.g. Title#;#Author\u00a0<\/p>\n<p>When properties have to be treated like dates, use ASB_DateTimeDT_Props the same way as the text property described.\u00a0<\/p>\n<h3>Summary\u00a0<\/h3>\n<p>Before creating a search refiner a lot of investigating was necessary, but it can be built for SharePoint 2007 fully in script.\u00a0<\/p>\n<p>Also this example can be extended to show the number of items per author and of course other refiners can be built on other properties.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SharePoint 2010 has a lot of nice features. One of them are search refiners. The search results can be narrowed down by Result Type, Site, Author, Modified Date, etc. When knowing and seen that feature I\u2019m really disappointed SharePoint 2007 &#8230; <a class=\"more-link\" href=\"https:\/\/www.itidea.nl\/index.php\/sharepoint-2007-author-search-refiner\/\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[11,13,33],"class_list":["post-919","post","type-post","status-publish","format-standard","hentry","category-sharepoint-2007","tag-jquery","tag-moss-2007","tag-spservices"],"_links":{"self":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/comments?post=919"}],"version-history":[{"count":18,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/919\/revisions"}],"predecessor-version":[{"id":945,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/919\/revisions\/945"}],"wp:attachment":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/media?parent=919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/categories?post=919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/tags?post=919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}