Category Archives: SharePoint Search

How To Specify People as a Search Scope / Content Source Using SharePoint 2013 REST API

I had reason to work with the SharePoint 2013 Search API via REST for the first time.  I wanted to search for people, not documents.  The key learning here is that you specify content sources via its GUID (or at least in this case). The following jQuery snippet shows how:

    loadExpertsAsync: function() {

        jQuery.support.cors = true;

        $.ajax({
            url: this.CreateFullApiUrl() +
                "?querytext='portals'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'" +
                "&selectproperties='LinkedInProfileUrl,GoogleCirclesProfileUrl,BALargeProfilePictureUrls,BAGridPictures,WorkEmail,Skills,AboutMe,Interests,JobTitle,PastProjects,PictureURL,PreferredName,TwitterHandle,LinkedInProfileUrl,PreferredName,GoogleCirclesProfileUrl'" +
                "&rowlimit=99",
            method: "GET",
            headers: { "Accept": "application/json; odata=verbose" },
            cache: false,
            success: function (result) {

In my case, I’m running the API against SharePoint online. To get the GUID, I followed these steps:

  1. Access the SharePoint admin center
  2. Select “search” from the left hand navigation
  3. Select “Manage Result Sources”
  4. Select “Local People Results”
  5. Look at the URL.

My URL looked something like:

https://xyzzy-admin.sharepoint.com/_layouts/15/searchadmin/EditResultSource.aspx?level=tenant&sourceid=b09a7990%2D05ea%2D4af9%2D81ef%2Dedfab16c4e31&view=1

The sourceid parameter is what worked for me.

(I understand that the sourceid may actually be a sort of permanent thing with SP, but I’ll always check anyway 🙂 ).

</end>

undefinedSubscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

One Cause for “The creator of this fault did not specify a Reason.”

I’ve been doing a lot of work with SharePoint search lately and specifically the KeywordQuery class, properties and methods.

If you want the result set to return results above and beyond the usual suspects (see here), you add it to the SelectedProperties collection, as in:

myKeywordQuery.SelectProperties.Add("xyzzy");

Many thanks and a tip of the hat to Corey Roth and this enormously helpful blog post (http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/02/19/how-to-use-the-moss-enterprise-search-keywordquery-class.aspx)

In my case, “xyzzy” isn’t actually a managed property.  When I added it to SelectedProperties anyway, SharePoint threw one of my favorite ever runtime exceptions:

“The creator of this fault did not specify a Reason.”

I especially like the capital “R” in Reason.  This sounds to me like the .NET equivalent of “I have no mouth, and I must scream.”

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Handy Reference: Default Results from KeywordQuery Search

When you invoke the Execute() method on a KeywordQuery, you can create a ResultTable based on ResultType.RelevantResults.  This code snippet illustrates what I mean:

ResultTableCollection resultsTableCollection = myKeywordQuery.Execute();

ResultTable searchResultsTable = resultsTableCollection[ResultType.RelevantResults];

The resulting table will have the following columns of information: 

WorkId
Rank
Title
Author
Size
Path
Description
Write
SiteName
CollapsingStatus
HitHighlightedSummary
HitHighlightedProperties
ContentClass
IsDocument
PictureThumbnailURL
ServerRedirectedURL

I derived this list from a SharePoint 2010 environment, enterprise edition.  Hopefully it will be handy to someone in future.

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

SharePoint 2010 KeywordQuery and the HiddenConstraints Property

I’ve been doing a bit of work with the KeywordQuery object in SharePoint 2010 and making use of the HiddenConstraints property.

I didn’t find any immediately helpful information on the that property, so I thought I’d quickly jot down how I’ve been using it.

As far as I can tell, this is an automatic constraint added to the query so that you can sort of park it there and not worry about it.  As such, it’s just another keyword (or set of keywords) and modifiers that you can type in to the UI when you do a keyword search.  Here’s an example:

keywordQuery.HiddenConstraints = "scope:\"Industry\"";

You can add additional constraints with a space delimiter.

keywordQuery.HiddenConstraints = "scope:\"Industry\" defense";

The above is saying in English, “run a keyword query looking for “defense” and furthermore, use the “Industry” scope.

Here’s another way of looking at it:

image

I’ve been using it to provide a context-dependent automatic scope on a custom web part.  When the user clicks on a tab and clicks a search button, the tab dictates a particular search scope.  It’s working well so far.

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

One Reason for “One or more field types are not installed properly”

I was making a small tweak yesterday to a web part that does a CAML query against a list.  I made the change, deployed it and got hit with an error:

An unexpected error has occurred in the Three Day Outlook Weather Forecast WebPart. Please contact the system administrator. One or more field types are not installed properly. Go to the list settings page to delete these fields.

I was facing another oddball issue earlier so I didn’t immediately connect my CAML query with the error that SharePoint was reporting to me.  I did a quick bing search and and found this helpful blog post by Sandeep Nahta  (http://snahta.blogspot.com/2009/01/one-or-more-field-types-are-not.html).

Here is the bad query:

query.Query += "<Where><And><Neq><FieldRef Name=’Abbr’/><Value Type=’Text’>SFNY</Value><FieldRef Name=’Abbr’/><Value Type=’Text’>SFIS</Value></Neq></And></Where>";

Here it is fixed:

query.Query += "<Where><And><Neq><FieldRef Name=’Abbr’/><Value Type=’Text’>SFNY</Value></Neq><Neq><FieldRef Name=’Abbr’/><Value Type=’Text’>SFIS</Value></Neq></And></Where>";

So, the moral of the story is: make sure your CAML is correct or you may get an oddball error.

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

</end>

Announcing the Microsoft Enterprise Search User Group

I’m very excited to announce that Natalya Voskresenskaya, my fellow SharePoint MVP and partner (with far less help from me than she deserved) is launching a new user group devoted to enterprise search based on Microsoft technology.  As a practical matter, this boils down to SP 2010 search and a lot of talk about FAST, especially in our first session.  Natalya and I have written a lot about FAST over the last year on our blogs (Natalya has more and better stuff than I!).

Our first meeting is coming up in just a few weeks in New York at Microsoft’s newly renovated offices on 6th near Rock Center.  If you’re in New York on 12/9, you have no excuse not to make an appearance.  Likewise for you Jersey people.  Connecticut people can stay home (just kidding!). 

NY/NJ/CT people should skip this paragraph.  We also plan to record the session and run a live web session so if you live outside the tri-state area, you should be able to tune in. 

I’ll blog about this some more as this most auspicious day approaches but register now.  After you register, the long wait begins.  During that time, clear your schedule, break the news to your family and alert the media because you won’t want to miss Nate Treloar launch our group to the moon and beyond 🙂

Find out more from our official site: http://www.sharepointgroups.org/enterprisesearch/default.aspx.

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Governance and SharePoint Search – It’s Never Too Late to Start

I wrote an article (http://searchwinit.techtarget.com/tip/0,289483,sid1_gci1345231_mem1,00.html#) for SearchWinIT.com on governance as it relates to SharePoint Search.  It’s not in my usual "voice" but that’s editing for you 🙂

Here is how it starts:

Although nearly every aspect of SharePoint can benefit from a strong governance plan, MOSS 2007’s enterprise search functionality benefits most of all.

Like all parts of SharePoint, there is good news and bad news about governance. For many organizations, the bad news is that it’s extremely difficult to incorporate a governance plan where none existed.

But here’s the good news: You can quickly configure and improve on enterprise search at almost any time. And when you implement a governance plan for enterprise search, you can see immediate results.

One of the problems with SharePoint and governance is that companies often get knee deep into SharePoint with no governance plan and by then, there’s no easy path forward to solve it.  No so with Search.  Read the article to get my thoughts on that subject.

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags: ,

Services on Server Does Not List Search — Why?

I was chatting today with Agnes Molnar (the only person I know that I know in Hungary) about a strange search configuration problem.  Namely, search was missing from the "services on server" display (via Central Admin -> Operations -> Services on Server).

I had a look at a functional VM on my own machine and together, we determined that search was not installed on that server.  There are probably a few ways to do this, but we did it by confirming that "Office SharePoint Server Search" was missing from the list of services via Start -> Administrative Tools -> Services.

Oddly, the associated .exe *was* on the server ("C:\Program Files\Microsoft Office Servers\12.0\Bin\mssearch.exe").

I did a quick search and found this blog entry: http://msmvps.com/blogs/obts/archive/2006/10/19/189466.aspx

That’s an email chain with this key point:

"I solved this problem. It was my mistake. I choose "Web front end" instead of "Complete" during install."

This was promising, but we weren’t sure if the installer had actually picked WFE instead of complete when installing MOSS. 

We checked for the first (earliest) version of the PSCDiagnostics* file in the 12 hive log directory and in there, we found that the installer had, in fact, configured this server to be a web front end.  End of story and it had a happy ending.

(Somewhere along the line, Bob Fox got involved, but all I remember him contributing to the discussion was a comment about Fable 2).

Update: Agnes blogs about this subject here: http://dotneteers.net/blogs/aghy/archive/2008/11/06/wfe-vs-complete-installation.aspx

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags:

Quick Tip: Use “IsDocument:1” to Trim Search Results

Update 11/03/08: Fellow MVP Mike Walsh correctly points out that this is a WSS 3.0 / MOSS feature.  It does not work in WSS 2.0 or earlier.

Updatte 11/03/08: (Second update in one day!): Be sure to read the excellent comment from "nowise" for more info and another good xref link.

Two questions came up in rapid succession this week on the MSDN forums asking a variation of this:

"When I search a keyword, folders from my document library with that keyword in their path will come out first in my search results. I don’t want that to happen. Files with that keyword are more important to me.  I don’t want to see folders at all."

This is actually quite easy to do out of the box.  Simply add a "IsDocument:1" to the search query and SharePoint search (both WSS and MOSS) will restrict itself to showing actual documents.

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags:

Has Your Search Committee Met This Month?

It’s the beginning of the month and now is as good a time as any for your company’s search committee to get together and analyze Best Bets, successful and not so successful searches, etc.

You don’t have a search committee?  Then form one 🙂

WSS and especially MOSS search benefit from some human oversight.  Investing a few hours a month on a consistent monthly basis  is not only more fun than a barrel of monkeys, it can:

  • Give insight into the information needs of the enterprise.  If people are searching left and right for topic "xyzzy," you know that’s an important topic to the enterprise. 
  • Identify potential training requirements.  If people are searching for topic "xyzzy" but should really be searching for "abcd" then you can use that to educate folks on where and how to find the information.
  • Help your organization refine its information architecture. 
  • Identify opportunities to enhance the thesaurus.
  • Other opportunities will no doubt present themselves.

Who should be on search committee?  You would know your people best, but consider:

  • At least one (and maybe only one) IT person who understands (or can learn) the various ways to tweak search, including best bets, thesaurus, managed properties, etc.
  • Several subject matter experts that can read the search reports, ingest it and communicate business-savvy actions to IT so that IT can push the buttons, pull the levers and open/close valves as necessary to on committee recommendations.
  • One or more information architects who can validate, one way or another, whether the information architecture is search friendly and whether it’s working out well for the enterprise.
  • A rotating seat on the committee.  Bring in one or two people who don’t normally participate in these kinds of efforts.  They may bring unusual and valuable insights to the table. 

Happy analyzing!

</end>

Subscribe to my blog.

Technorati Tags: