Mittwoch, 27. Juli 2011

Bring up crawled contend to the user (map indexed contend to a managed property)

In one of my last post I wrote about extracting data via xpath out of the “hithighlightedsummary” field (LINK) - here I want to show another method to make contend that is in the search index usable for user experience.
I just want to use the same SQL Table as in my previous posts. Also I want to bring up the field “ApkBezeichnung1” (which is called “Task” in the BCS SharePoint List based on this SQL table in the previous post) to the front
 So the underlying and crawled data locks like this:

Now let’s use some PowerShell calls to see what the search server, in my case the FAST search server knows about this contend source. The crawled contend / crawled properties are normally sorted in so called Metadata Categories. This PowerShell call shows all existing Metadata Categories on your server:
As result we get something like that:

We see that there is a category called “Business Data” witch contains all crawled Data coming from any BCS source
Next we want to do is showing all crawled properties in the Metadata Category “Business Data
Therefore we use this call:
Get-FASTSearchMetadataCrawledproperty |ForEach-Object{ if ($_.CategoryName -eq "Business Data") {$_.Name} }

Another way to find out details of the crawled contend / crawled property we want to bring to the front is this call:
Get-FASTSearchMetadataCrawledProperty -filter apkbezeichnung1
“apkbezeichnung1” is name of the field in the SQL table.
The –filter parameter does not support wildcards. Matching is case-insensitive, and matches a string anywhere within the name attribute of the crawled property:

So we now know that the field is crawled and that the name of the crawled property is “read listelement.apkbezeichnung1”.
To use the property in SharePoint Search we have to map the property to an existing managed property or create a new managed property. I will create a new one with these calls:

1.       $v1 = New-FASTSearchMetadataManagedProperty –Name "BCSTask” –type 1

2.       Set-FASTSearchMetadataManagedProperty –Name “BCSTask” –Queryable $true –
StemmingEnabled $false –RefinementEnabled  $false

3.       $v2 = Get-FASTSearchMetadataCrawledProperty -filter apkbezeichnung1

4.       New-FASTSearchMetadataCrawledPropertyMapping –Managedproperty $v1 –crawledproperty $v2

The result is:

We now have a managed property. It can be used in SharePoint Search after the next crawl of the contend source. The managed property contains contend from the database column “ApkBezeichnung1”.
Now we can do something like this and use the new managed property “BCSTask” direct in the search box: search term: “BCSTask:Dongel”

Dienstag, 19. Juli 2011

Append an external (crawled) property from a BCS source to a search refiner

Append an external (crawled) property from a BCS source to a search refiner
In this case I will use a field from an SQL table as a refiner in my SharePoint Search. The SQL table contains information about ORDERS from external ERP system. This ORDERS list is accessible via a BCS connect from SharePoint and also you can search for those ORDERS via SharePoint search. There is a default refiner called AUTHOR in SharePoint search. So “author” is here similar to the creator of the ORDER.
Here is the SQL table. You can see the “VorAngelegtVon” field which contains the person who created the ORDER in the ERP System:

This SQL table is integrated in SharePoint via BCS. (How to do this is not part of this post). The result looks like this:

If you start a search with the searchterm “ERP_Orders” (ERP_Orders is the profile site name for this BCS source) you get a result set shown below:

This resultset contains entries from the BCS list “ERP_Orders” and you see only two refiners are available -> Sites which contains the source and the Modified Date
Next step is to find out if there is a crawled property containing the field “VorAngelegtVon” from SQL table / BCS Source. To do this I used PowerShell.
From PowerShell execute this command:
(There is no fundamental different using FAST Search or SharePoint Search in this case. You only have to check out using the correct cmdled )

Get-FASTSearchMetadataCrawledProperty -filter <name of the field>
(You see that I used the FAST search version. For SharePoint Search the cmdlet is SPEnterpriseSearchMetadataCrawledProperty)

In our case the command is: Get-FASTSearchMetadataCrawledProperty -filter VorAngelegtVon
The result shows that there is a Crawled Property containing the data we want to use. The name is “read listelement.vorangelegtvon” and it from the category “Business Data”, so we are on the right path.
Now let’s see the details for the property “Author”. This is an existing managed property, so we have to use another cmdlet:
get-FASTSearchMetadataManagedProperty -name <name of the managed property>
(For SharePoint Search the cmdlet is SPEnterpriseSearchMetadataManagedProperty)

In our case the command is: get-FASTSearchMetadataManagedProperty -name Author

You see that the property “MappingDisallowed” is set to False. That mean we can map our crawled property to this managed property. The property “Author” is also flagged as “RefinementEnabled”. This is necessary to be shown in the refiner panel.
To map the crawled property “VorAngelegtVon” to the managed property “Author” use the following command:
$vm = Get-FASTSearchMetadataManagedProperty -Name Author
$vc = Get-FASTSearchMetadataCrawledProperty -filter VorAngelegtVon
New-FASTSearchMetadataCrawledPropertyMapping -Managedproperty $vm crawledproperty $vc
(For SharePoint Search the cmdlet is SPEnterpriseSearchMetadataMapping)

To check if the mapping is created run this command:
Get-FASTSearchMetadataCrawledPropertyMapping -name Author   
Before the mapping is taking any effect a crawl of the contendsource containing the BCS source is necessary. An incremental crawl is enough.
After the crawl is finished you can work with the new refiner and filter the ORDERS by Author:

This can be the stage for a search driven solution showing the ORDER from the ERP system refined by the Creator / Author….
IMPORTEND: this works only for managed property who default set as a refiner. (Flagg “RefinementEnabled” of the managed property must be set to “true”).  If the managed property is not set as a refiner by SharePoint default you must edit the XSLT for the Refinement Panel -> How to do this you can find for example here:  SharePoint analyst hq

Donnerstag, 7. Juli 2011

Customize search results from an external contend type with xslt and xpath

First let’s have a look at the underlying data first. In this case it’s a simple SQL database table. The table contains tasks from an ERP system:
Using SharePoint Designer we now integrate this table as an External List in SharePoint. Many other SharePoint bloggers have written or done presentations about this concept, for example: Ingo Karstein (Link)
Next step is now creating a profile page to show the search results from the external data in SharePoint Search. This is also a topic many other bloggers written about. Just see Corey Roth blog post: Link
Doing all this we get a search result looking like this:
….not really nice.
To Customize the Search Result using SharePoint Designer and XSLT follow the steps described by Laura Rogers (Link). If you do this with the external contend source you get something looking like this:
The point is there is no field like “Task” or “Date” as in the source SQL Table.
All this information is packed together in the field “hithighlightedsummary”. So first we have put this field to the table . You can do this via drag & drop. The result is similar like this:
Now click “Edit Formula….”in the context menu
You get something like this:

To filter special contend out of the “hithighlightedsummary” field just you Xpath. For example we want to filter out the “Task” field this Xpath expression will work (of cause only for my demo here): substring-before(substring-after(hithighlightedsummary, 'http://intranet/bcs'), 'miclas')
The result is showen in the Preview Section in the edit dialogbox:
With this Xpath query, some other sorting and design changes we are able to get a Data Source View looking like this:
And with the steps described by Laura Rogers (Link) we are now able to create a Search Result looking like this:

Mittwoch, 6. Juli 2011

Just submitted some sessions fort he Collaborations Days 2011 in Luzern on the 29 – 30 November 2011:
-          Search Driven Applications - based on SharePoint 2010 Search Engine
-          Features around BCS
-          Unleash the power of SharePoint Search with Powershell
-          BI Features in SharePoint 2010
 Hope that some will be interesting for the event-team.

Freitag, 1. Juli 2011

First Post

lets see, I started this blog just to share interesting stuff around SharePoint.... and the interesting stuff is coming soon ;-)