Thursday, September 26, 2013

Offline URL Decoder - or GUID Decoder :)

I recently read a post by Jasper Oosterveld about how to decode a URL encoded string using the on-line page http://meyerweb.com/eric/tools/dencoder/.
I’ve used that a lot myself, but an almost as easy way is to use your browser. In IE you may type
javascript:unescape('%7BBE72746E%2D85DA%2D41AB%2DBB91%2D73941AF9DC10%7D')

in the address bar and it will decode it on the fly. Of course there is a quirk as some versions of IE strip the javascript part if you paste it.

image

Same works in Chrome if you first open a new blank tab, and then enter the same command. If you re-use an existing page it fails.

Or in your favorite browser, hit F12 which should open developer toolbars, choose the javascript console and execute the command there. Below is a screenshot from IE11.

image

Then all you’re left with is if it’s still easier to open that on-line page Smile

Monday, September 23, 2013

Creating crawled properties with SharePoint 2010 and FAST

When you do a lot of work with FS4SP you sort of forget that trivial tasks may not be so trivial for those outside your nose tip. Recently at a customer another developer was adding some new <meta> tags to a SharePoint page, and he was trying to script the crawled properties (cp) in order to move them between the environments.

Yes, you may always kick off new crawls to get the cp’s created, and then map them manually, but this is often not doable as you don’t have access to Central Admin or the servers once you move out from your test environment. Hence, you send over deployment scripts.

The issue this time was which Crawled Category group will the crawled property appear in, and once you have the name, what’s the GUID, which you need to script it as it doesn’t take the name (the reason being a group may have more than one GUID/group associated behind the scenes… figures!?)?

To help out, I figured I’d list the GUID’s needed when creating crawled properties for the most used categories:

Category GUID Notes
SharePoint 00130329-0000-0130-c000-000000131346 All columns in SharePoint will have a crawled property created by default in this category with the ows_ prefix.
Web d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 All pages of type HTML will have <meta> tags added as crawled properties in this category. It does not matter which crawler was used, SharePoint, Web, File.

The type of the value is always text (variant type 31).
Business Data – BCS 2edeba9a-0fa8-4020-8a8b-30c3cdf34ccd Columns from BCS connections appear in this category.

The easiest way to get the right GUID is by kicking off a crawl, and then inspecting the properties of one of the auto-generated crawled properties. You may also run the following PowerShell commands, which may yield more than one GUID, and might not help out that much:

$cat = Get-FASTSearchMetadataCategory "Web"
$cat.GetPropsetMappings()

Guid
----
d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1
70eb7a10-55d9-11cf-b75b-00aa0051fe20
c82bf596-b831-11d0-b733-00aa00a1ebd2
c82bf597-b831-11d0-b733-00aa00a1ebd2


You can learn how to work with crawled and managed properties via PowerShell over at TechNet - http://technet.microsoft.com/en-us/library/ff191246(v=office.14).aspx

Monday, September 2, 2013

Appending query terms in SharePoint 2013/O365 without adding them to the search box

In SharePoint 2010 you can append query terms to a search query by either setting a property on the Core Results web part, or by using the a= query parameter.
image
Neither of these possibilities exist in SharePoint 2013 so you have to do a workaround. If you read my post Limiting search results by exact time in SharePoint 2013–and how to do FQL you might have picked up on how you can use the refiners to pass in arbitrary FQL. This means, the refiner parameter is not only useful for refinements, but you may use it to append parts to your query as well.