SharePoint Search for Boolean property values Issues


Very interesting , issue that I came across a few times and wasted some more time each time ( I guess I am getting old)

The Problem :

SharePoint search ( advanced webpart ) does not recognize the syntax for the boolean values

While the search refinement panel does work fine and ale to filter the result set on the boolean value just fine.

but it looks like that problem here is somthing like this.

On you Search

<PropertyDef Name=”CarIsBlue” DataType=”boolean” DisplayName=”Blue Cars only”/>

If you Select

[“Blue Cars Only”      is true ]

you don’t get any .

but the reverse of that works just fine

[“Blue Cars Only”      is false ]

You can detect that by checking the search syntax on the http request (url ) at the result page.

http://MyServer.Domain/SearchPage.aspx?k=CarIsBlue

No Results

and If you select the false option

http://MyServer.Domain/SearchPage.aspx?k=-CarIsBlue

All Results

It is not a problem if documented (I guess) , so here is the Microsoft official documentation

http://msdn.microsoft.com/en-us/library/ms541692.aspx

A Discussion here

http://social.technet.microsoft.com/Forums/en-ZA/sharepoint2010customization/thread/7404d94a-14ab-4383-b133-fcd879768e7c

Temporary solution that works fine

this so called literal can be cast

so

You can define the search property query as a string while it is acutally a boolean.

so ,

In your property definition you can change that to

<PropertyDef Name=”CarIsBlue” DataType=”text” DisplayName=”Blue Cars only”/>

and Ask the users to type is the value (True , true , TRUE , Yes or yes)

that should work fine.

I hope the 2010 (or 201x version)  search engine folks can find a solution

Thanks

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s