Thursday, September 11, 2014

Sending in arbitrary extra query parameters to your SharePoint Search Center

I touched on this subject previously in my post Appending query terms in SharePoint 2013/O365 without adding them to the search box, but I did not have a solution at that time. Now I have.
Topics covered
  • Extend Search.ClientControls.js to support arbitrary FQL statements
  • Add appended search queries to your page without them showing in the search box
As mentioned in Limiting search results by exact time in SharePoint 2013–and how to do FQL you can pass extra query information beside the search text itself by using the refinement filter parameter of a query. This parameter takes FQL by default which is very handy at times. So, the refinement filter property is not just for adding refiners, but can be used to add any FQL statement of your choice, that being an extra query term or XRANK statement.

Let that sink in and think about the possibilities. The good guys at FAST actually handed over the master key to search, probably without knowing it!


Monday, September 8, 2014

S15E09: Query Rules – Trigger happy circumstances (context)

This is episode nine in the series “SharePoint Search Queries Explained - The Series”. See the intro post for links to all episodes.
This is one of my favorite areas of search, but also one of the harder ones to get right. The overall concept is as follows:

For a specific group of users you change the search experience based on that group.

In the sample image above I show a promoted result for new employees who happen to like StarWars. It’s a very simple concept, but a really powerful one, and it’s up to you to decide what your query rule should do with your result – promoted results, change sort order, change what is displayed etc..

Thursday, September 4, 2014

Debug crawled properties and creating a refiner for Content Source without modifying the existing ContentSource managed property

imageThat was a really long post title, but it explains what this post is about, so just look past the dryness of it.

The first part of the post explains how you can see what crawled properties are available for an item, and the second part is how you can use one of the RefinableStringXX managed properties as a refiner for content source. (Content sources is what you set up in your Search Service Application which points at what sources you want to index)

Say you have set up multiple content sources in SharePoint. One for SharePoint, a couple for file servers and maybe a web crawl or three of some web sites. Let’s assume all these sources have a mental footprint in the mind of your information works, and as such you want to show a refiner on the search page based on these content sources.

Out of the box SharePoint 2013 have a managed property named ContentSource which stores the name of the content source, but this property is not refinable, only queryable.

Monday, September 1, 2014

Importing Search Configurations on the SSA

imageYou might have noticed the settings for site collections have options to export and import search configuration files, which is very nice indeed. The Search Service Application however, does not have these options. What is available is the use of CSOM to export the SSA configuration via the SearchConfigurationPortability class. If you try to import a configuration file to the SSA you will simply get a nice error, explained at the documentation page for SearchConfigurationPortability with this interesting quote: ….however, you cannot import customized search configuration settings to a Search service application (SSA).

 Note: This does not apply to SharePoint Online where you can import/export search configuration from the UI for your tenant.

So, you have export, but no import!

Thursday, August 28, 2014

PDF previews enabled in Office365 for search and document libraries


With the March 2013 PU SharePoint 2013 on-premises got this functionality as Office Web Apps added support to open PDF documents. Not a big surprise as Word itself can open PDF documents.

For on-premises you could for search results easily add a Result Type to allow for PDF previews, while for document libraries the best option is Wictor Wiléns farm solution which patches up, or my more ad-hoc solution as blogged at

Long ago this was also available in SharePoint Online, but it was removed at some point for unknown reasons – meaning they turned off the PDF support for the online WAC server. Good news is that they are back!

The updates themselves

For search it is the Item_PDF_HoverPael.html file which has been updated - _catalogs/masterpage/Display Templates/Search/Item_PDF_HoverPanel.html. Hopefully this update will find it’s way on-premises as well, or simply copy it from an online tenant locally.

For document libraries the filepreview.js file has been patched to support .pdf, same as Wictor and I have blogged about.

Tuesday, August 26, 2014

Limiting on types of file in SharePoint

There are two managed properties you might consider for limiting or refining on the types of files indexed in SharePoint. One is FileExtension, the other is FileType. The main difference is that FileType is based on the content inside the document, not the extension, while FileExtension merely strips of the file extension of the file name.

This means that if you have a text file named test.txt and rename it to text.xlsx, on the FileType refiner it will be sorted under txt, not xlsx.

My personal preference and SharePoint’s default behavior is to use FileType.

When it comes to Display Templates, SharePoint will by default use FileExtension. This means if you rename test.xlsx to test.docx, it will use an Icon for Word, but show a refiner for Excel – unless you override and change the behavior in your Display Templates that is.


Thursday, August 21, 2014

How To: Search up items which don’t have a value set

imageOne of the harder things in search is to search for something which don’t have a value set, and it sort of goes against how a search engine works. If an item is missing a value on a property, then this property is not set in the search index. It will be non-existent.

Using SQL you can use operators such as IsNull to return items which are missing a value, but using SharePoint search you don’t have this operator.

A common work around is to provide some dummy/default value, and you can filter on this one instead. But often this is not an option.

Tuesday, August 19, 2014

“Optimize for frequent use” setting in a Result Type


You have probably seen the check box for Optimize for frequent use if you have ever created a Result Type in SharePoint. But, what does this mean?

Saturday, August 9, 2014

S15E08–Query Rules – I am Trigger Happy (intent)

This is the eight episode in the series “SharePoint Search Queries Explained - The Series”. See the intro post for links to all episodes.

In this fourth episode around query rules, I am going to focus on capturing the intent of the user. What is the person searching really looking for? If you look at a random query log you can, more often than not, easily pick out queries which you could call “Q and A queries”. By “Q and A query” I mean a query which is meant to bring back an answer which you can take action on right away.

Wednesday, July 23, 2014

Gotcha on when a Query Rule Doesn’t Trigger

A small heads up if you are creating query rules, and you notice that they won’t trigger. If you include a KQL operator or wildcard as part of your query, the rule won’t trigger.

Consider the screenshots below where the first one shows the wiki block, and the rest don’t. And it doesn’t matter which triggering mechanism you choose, they won’t trigger.

Reading closely on the setup page this is expected behavior:


You can also test this using the SharePoint 2013 Query Tool or the Query Tool test feature on the Manage Query Rule settings page in SharePoint.