Thursday, July 9, 2009

Sharepoint Wild card property Search

Scenario:
SharePoint has out of box approximately 128 mapped properties and its very easy to add our own properties. One advantage of these properties is refined search or advanced search. One thing which is not documented is wildcard property search.

Sharepoint does support wildcard property search

Notes 1:
Only prefix matching is allowed in property searches, which means that you must have at least the first letter of the property value to complete the search.

Examples:

1. filename:program ( without any quotes )

This will return all the results with items starting with program. i.e. programming.docx , program.xslx, etc . This is kind of stem search

2. filename:"program" ( with quotes )

This will return all the results with items with program. i.e. "program.xslx" only

Note 2:
You can search for multiple property values in one query. The spaces between property:value entries are interpreted as an AND.This is only true if your query contains different properties.

Examples:
1. author:"Sandeep" filetype:docx

Search will returns Word 2007 documents that are authored by Sandeep

Note 3:
You can search for multiple property values in one query. If you use the same property Search Server interprets the space between the property:value entries as an OR.

Examples:
1. author:"Sandeep" author:"Srini"

This query will returns items authored by Sandeep and items authored by Srini.

Note 4:
You can also use wildcard characters in property searches. Wildcard searches include characters, such as “*”, which allows the search engine to substitute any number of characters and “?”, which allows the search engine to substitute any single character.

Prefix matching is also required when you use wildcard characters. This means that you cannot insert wildcard characters in the middle of a property value such as W*ton or at the beginning of a property value such as *ington.

Examples:
1. author:"Sandeep" filetype:doc*

This query will returns documents authored by Sandeep in docx or doc format.

3 comments:

dave.dolan August 7, 2009 at 11:48 AM  

Thanks very much, I needed this info. I'm guessing by proxy of this information that there is no way to create a search scope that 'includes all items with a value for a property' as opposed to those without a value for that property. Do you know if there is a way, supported or not, around that? Can I write my own crawler and have it add items to a scope? I really want to be able to create scopes based on whether or not they HAVE a property value, not just if it contains some specific value...

Robert February 4, 2010 at 1:52 PM  

Thanks Sandeep. Nice regurgitation of technet article http://technet.microsoft.com/en-us/library/dd981043.aspx.

Unfortunately, you should have tested it first before posting. You would have found that wildcard, indeed, does not work for properties in MOSS 2007.

Dave: You can add a property include rule in the Search Scopes section under Site Settings > Site Collection Administration. You need to make sure your property is indexed if it comes from a custom column and mapped to a managed property first. Then go to the Search Scopes page and add the include rule.

Robert
Surfray

jag February 26, 2010 at 8:02 PM  

Hi Sandeep , seems to be nice article. I have been using url queries to implement search functionality. (Are you wondering why i am trying to use urls for search when i have "Advanced search webpart ? , i have my own reasons.)
============================
I am using this link to build my search queires
http://blogs.officezealot.com/mauro/archive/2008/11/24/21250.aspx

This link is helping me. i started building my own advanced search page and save my search functionalities
But have i some problem. It would be really great if you have answers for below

i want to use more than one Managed property in a single query.
For example :
----------------
http:///results.aspx?k=MyTerm
http:///Results.aspx?k=MyTerm&k=ManagedPropery1:Value1
----------------------
The above two urls worked for me, i want to improve that with adding more managed properties as below and its not working for me, is there any other way?? This will help me a lot
-----------------------------
http:///Results.aspx?k=MyTerm&k=ManagedPropery1:Value1
&k=ManagedPropery2:Value2

Do you have any idea? It would be great if you help me