Windows Vista Search: Syntax Update

I recently learned some new things about the Search APIs in Windows Vista, including some great improvements in the SQL syntax for the OLE DB Provider for Windows Search. (Thank you Chris McConnell – Architect on the Search team – for driving these changes, and for taking the time to explain them to me!).

There’ve been some simplifications in the syntax that happen to address a couple of things I found to be a bit odd and cumbersome:

  • System property names no longer require double quotes. Recall that the column names specified in the SELECT statement must be properties from the Windows Vista property system; and since the naming convention for properties includes dots (System.Application.Property), property names had to be delimited with double quotes. The double quotes are no longer necessary for system-defined properties (the ones that begin with System.)
  • ..SCOPE() no longer required in FROM statement. There is only a single catalog that can be searched on the desktop – and since scope is actually defined using the “Scope=” predicate in the WHERE clause – you no longer need to add that funky “..SCOPE()” stuff at the end of the FROM clause.

So, a query like this:

SELECT “System.ItemName”, “System.ItemUrl” FROM SYSTEMINDEX..SCOPE()

can now be written like this:

SELECT System.ItemName, System.ItemUrl FROM SYSTEMINDEX

Much better, isn’t it?

(Note that these changes reflect added flexibility, and won’t break any existing queries)

Comments (4)

  1. Under Microsoft Live visade jag hur enkelt det var att i Windows Vista använda sig av det Search API

  2. atkulp says:

    It should be noted (from what I saw on RC2) that if you omit the double quotes from the column names, the result set has all of the column names in upper case.  This could throw off logic in weird places if you actually rely on the column names instead of ordinal.

    Also, I’m really struggling with the list of columns/properties.  So many in the SDK documentation do not appear to work.  As far as I can tell, either a column is good or not.  In other words, if you specify a System.Media.* property when it doesn’t apply, you get a <null>, not an error.  If I get "column does not exist" this implies that it is never valid with this provider.  Will the OLE DB search columns be documented soon?


  3. Windows Desktop Search (WDS) Properties

  4. atkulp says:

    I posted a list of the shell properties that work with WDS on my blog:  Can you talk about why the other columns aren’t known to the search index?