Thursday, July 21, 2011

Pipeline Extensibility - Checking for a Value

This post is going to cover an interesting quirk I have found when you attempt to retrieve the value of a web property (non-Sharepoint) in the pipeline extensibility.
Say for example you have a web page with the meta tag of COST. 

<meta name="COST" content="2000">
When the value come into your custom pipelineextensibility .exe it will look like this:

<CrawledProperty propertySet="d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1" varType="31" propertyName="COST">2000  2000</CrawledProperty>

Notice that the value is shown twice in the property.  The character that separates these values is the &H2029 (unicode paragraph seperator).

In order to work around this, you split the value based on that character.

Dim cArray As Char() = {ChrW(&H2029)}

Dim postCategoryValueArray As String() = catXE.Value.Trim().Split(cArray, System.StringSplitOptions.RemoveEmptyEntries)

Dim propValue As String = postCategoryValueArray(0)

No comments:

Post a Comment