<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>SharePoint</title>
        <link>http://geekswithblogs.net/mattjgilbert/category/10042.aspx</link>
        <description>SharePoint</description>
        <language>en-GB</language>
        <copyright>mattjgilbert</copyright>
        <managingEditor>mattjgilbert@yahoo.co.uk</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>MOSS 2007 People Search - Wildcard searching</title>
            <link>http://geekswithblogs.net/mattjgilbert/archive/2009/12/11/moss-2007-people-search---wildcard-searching.aspx</link>
            <description>&lt;p&gt;MOSS doesn't offer this out the box and of course many people would like to have it. Here's a quick and dirty javascript change which will offer this functionality. You'll have to forgive any inelegance in my coding, I'm a bit rusty ;)&lt;/p&gt;
&lt;p&gt;You need to edit the search.js file and add the following:&lt;/p&gt;
&lt;p&gt;A trim function&lt;/p&gt;
&lt;p&gt;&lt;code&gt;function trim(s)&lt;br /&gt;
{&lt;br /&gt;
 var l=0; var r=s.length -1;&lt;br /&gt;
 while(l &amp;lt; s.length &amp;amp;&amp;amp; s.substr(l,1) == ' ')&lt;br /&gt;
 { l++; }&lt;br /&gt;
 while(r &amp;gt; l &amp;amp;&amp;amp; s.substr(r,1) == ' ')&lt;br /&gt;
 { r-=1; }&lt;br /&gt;
 return s.substring(l, r+1);&lt;br /&gt;
}&lt;/code&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;and then insert the following into the GoSearch function&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;code&gt;          return false;&lt;br /&gt;
        }&lt;br /&gt;
        else return;&lt;br /&gt;
    }&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #ffff99"&gt;&lt;code&gt;// start of added block&lt;/code&gt;&lt;/span&gt;&lt;code&gt;&lt;br /&gt;
    var searchWords = trim(k);&lt;br /&gt;
    var testURL = '';&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;    // the target url we need to test comes from different places depending on the source page&lt;br /&gt;
    try&lt;br /&gt;
    {&lt;br /&gt;
        testURL = document.forms[0].elements[DDId].value;&lt;br /&gt;
    }&lt;br /&gt;
    catch(e)&lt;br /&gt;
    {&lt;br /&gt;
        testURL = Url;&lt;br /&gt;
    }&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;    var searchURL = testURL;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;    // only make changes if this is a people search&lt;br /&gt;
    if(searchURL.indexOf('peopleresults.aspx') != -1)&lt;br /&gt;
    {&lt;br /&gt;
        // if there is a value and it doesn't contain : (which is the case if named properties are already being searched)&lt;br /&gt;
        if((searchWords.indexOf(':') == -1) &amp;amp;&amp;amp; searchWords != '')&lt;br /&gt;
        {&lt;br /&gt;
            // lastname only&lt;br /&gt;
            if(searchWords.indexOf('*') == 0)&lt;br /&gt;
            {&lt;br /&gt;
                k = 'lastname:' + trim(searchWords.replace(/\*/g, ''));&lt;br /&gt;
            }&lt;br /&gt;
            // do we have more than one value (there is a space break)?&lt;br /&gt;
            // if so, use the first value for the first name and the rest for the last name&lt;br /&gt;
            else&lt;br /&gt;
            {&lt;br /&gt;
                searchWords = searchWords.replace(/\*/g, '');&lt;br /&gt;
                var wordBreak = searchWords.indexOf(' ');&lt;br /&gt;
                if(wordBreak != -1)&lt;br /&gt;
                {&lt;br /&gt;
                    k = 'firstname:' + searchWords.substr(0, wordBreak) + " lastname:" +  trim(searchWords.substr(wordBreak+1));&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    k = 'firstname:' + searchWords;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;/code&gt;&lt;span style="background-color: #ffff99"&gt;&lt;code&gt;// end of added block&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;    var sch = '?k=' + encodeURIComponent(k);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;    if(null != HdQId){&lt;/code&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;This should allow the following functionality:&lt;/p&gt;
&lt;p&gt;1) To search on a &lt;font color="#ff0000"&gt;first name&lt;/font&gt;, simply type the name or the start of it and run the search.&lt;/p&gt;
&lt;p&gt;e.g. &lt;b&gt;matt&lt;/b&gt; or &lt;b&gt;ma&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;2) To search for a &lt;font color="#ff0000"&gt;last name&lt;/font&gt;, put a * in front of your search text&lt;/p&gt;
&lt;p&gt;e.g. &lt;b&gt;*gilbert&lt;/b&gt; or &lt;b&gt;*gil&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;3) To search &lt;font color="#ff0000"&gt;full name &lt;/font&gt;enter both first and last names (again these can be partial names)&lt;/p&gt;
&lt;p&gt;e.g. &lt;b&gt;matt gilbert&lt;/b&gt;, &lt;b&gt;or matt g&lt;/b&gt; or even &lt;b&gt;m g&lt;/b&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;This all assumes you have not made any other changes to search or pages which will stop this working. It should work for out-the-box MOSS. You'll have to watch that any updates don't touch the search.js file of course as you might lose the changes.&lt;/p&gt;
&lt;p&gt;We've implemented this and added those search tips (1-3 above) onto the peoplesearch page and our customer people directory page.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/mattjgilbert/aggbug/136905.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>mattjgilbert</dc:creator>
            <guid>http://geekswithblogs.net/mattjgilbert/archive/2009/12/11/moss-2007-people-search---wildcard-searching.aspx</guid>
            <pubDate>Fri, 11 Dec 2009 15:04:22 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mattjgilbert/comments/136905.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mattjgilbert/archive/2009/12/11/moss-2007-people-search---wildcard-searching.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/mattjgilbert/comments/commentRss/136905.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Thanks</title>
            <link>http://geekswithblogs.net/mattjgilbert/archive/2009/05/05/thanks.aspx</link>
            <description>&lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 6pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Times New Roman" size="2"&gt;Thanks to &lt;a href="http://www.solidsoft.com/"&gt;Solidsoft&lt;/a&gt; for running a great day at Microsoft last week. Topics covered were BizTalk, SharePoint and using them to build successful SOA and BPM solutions.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 6pt"&gt;&lt;span lang="EN-GB"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="2"&gt;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 6pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Times New Roman" size="2"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 6pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Times New Roman" size="2"&gt;Being responsible for BizTalk and also having had SharePoint land on my plate recently, the day gave me some good ideas about where to take these platforms.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/mattjgilbert/aggbug/131815.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>mattjgilbert</dc:creator>
            <guid>http://geekswithblogs.net/mattjgilbert/archive/2009/05/05/thanks.aspx</guid>
            <pubDate>Tue, 05 May 2009 16:55:49 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mattjgilbert/comments/131815.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mattjgilbert/archive/2009/05/05/thanks.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/mattjgilbert/comments/commentRss/131815.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
