Just found this great code snippet online that does wildcard people search. Out of the box SharePoint, even with SP1 (I was hoping SP1 would add this functionality, but...), search does not return wildcard results. So, doing a people search on "Ric" would return only those people whose first names were actually entered into Active Directory as "Ric" or who had some field, like department, that had "ric" in it. The code is at the bottom of this post.
And, to give credit where it's definitely due, here's the link to the original post:
http://www.ramonscott.com/Home/tabid/37/EntryID/1/Default.aspx
Here's what a search in default people search looks like when I search on ric:
As you can see, there's only results that have *exactly* "ric" in them. The rest of the results, truncated because they have lots of client info in them, all are returned because the user has a department field of "RIC."
Here's what it looks like when the code is pasted into a content editor web part on the page:
And here's what it looks like when I click Search on the above box:
As you can see, I'm now returning results on users named Richard, as presented by the default peopleresults.aspx page. So, you could do this, or pay Ontolica $10K to do it for you. (Though we're still missing some search components that should be basic, in my opinion, such as wildcard results on non-people data and extended boolean search.)
Additionally, here's a link to where someone extended this code to be able to do wildcard searches on additional fields with people search:
Here's the code:
<script language="javascript">
//function to handle enter on keyboard
function txtWildPeopleFinder_KeyDown(e)
{
if (e.keyCode == 13 || e.keyCode==10)
{
e.returnValue=false;
DoWildPeopleSearch();
return false;
}
else
return true;
}
//escape apostrophes in search strings
function escapestr(str)
{
return str.replace("'","%22");
}
//search function
function DoWildPeopleSearch()
{
var firstname = escapestr(document.all["firstname"].value);
var lastname = escapestr(document.all["lastname"].value);
var url;
//search on last name
if(firstname == "")
{
url = "/searchcenter/Pages/peopleresults.aspx?k=LastName%3A" + lastname;
window.location=url;
return;
}
//search on first name
if(lastname == "")
{
url = "/searchcenter/Pages/peopleresults.aspx?k=FirstName%3A" + firstname;
window.location=url;
return;
}
//first and last
url = "/searchcenter/Pages/peopleresults.aspx?k=lastname%3A" + lastname + "%20FirstName%3A" + firstname;
window.location=url;
return;
}
</script>
<table cellpadding="3" cellspacing="0" border="0" width="100%" ID="Table3">
<tr>
<td width="80" nowrap>
First Name:
</td>
<td width="100%">
<input size="20" maxlength="100" id="firstname" name="firstname" type="text" onkeydown="txtWildPeopleFinder_KeyDown(event)">
</td>
</tr>
<tr>
<td width="80" nowrap>
Last Name:
</td>
<td>
<input size="20" maxlength="100" id="lastname" name="lastname" type="text" onkeydown="txtWildPeopleFinder_KeyDown(event)">
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="button" onclick="DoWildPeopleSearch()" value="Search">
</td>
</tr>
</table>
Thanks to Richard and Alex


