Problems and hints concerning SharePoint Search

Problems with search queries (sql syntax)

1) Problem using Boolean values

If you are querying a boolean property, there are problems when using a comparison like

isDocument = true

It turned out that this doesn’t work correctly – a workaround is to simply use

isDocument != false

This issue is also described in a comment at the msdn.

2) Problem using OR

If you are using an OR clause in your query and one of the columns in this clause does not exist or has a null value in a result item, this item is not returned in the search even if the other value in the OR clause matches (!!).

This issue is described in detail in this blog entry.

Row Limit

Another pitfall concerning search queries is the following:

The RowLimit property of the SPQuery class is set to 50 by default – so if you don’t change this to 0 (unlimited) the search will always return 50 elements at most.

Get Folders and Items

When using the method list.GetItems(query) only the items of the top folder are returned by default (and no folder items!). If you need to return all elements including the folder items you can use the following attribute of the SPQuery class:

query.ViewAttributes += " Scope=\"RecursiveAll\"";

Related Posts

  1. Windows SharePoint Services Search will not start (stuck in state “starting”)
  2. Filter in custom sharepoint lists for current user [Me]
  3. ECSpand Contract Management
  4. Deutsche Bezeichnungen bei Suchdropdown in Sharepoint
  5. SharePoint 2010: Open document vs. Download documents

Leave a Reply