Searching custom properties

Mar 7, 2007 at 12:17 AM
Edited Mar 7, 2007 at 2:27 AM
1) Should I be able search field/value pairs, e.g. "Name=IconUnderline AND Data=2"? If so where does the field name (the item on the LHS of the '=') come from? I am interested in searching for custom properties, not the properties that are defined for all files/music/email. For example you define the property PKEY_RegistryData in your NSE/property handler and this property has the name "Windows.Registry.Data" in the .propdesc. How do I search for things with a specific "Windows.Registry.Data" value? Can you search for custom properties through the Windows Explorer UI? How, if at all, does PKEY_Search_Contents relate to this?

2) Should I be able to search for and find registry keys/values via this NSE from the search box in the Start menu? If I search for "ShellFolder" from the Start menu I don't get anything from the registry. If I open Windows Explorer and browse into the Registry NSE and then search using the search box in Windows Explorer I get registry keys/values in my results.

3) Does anything need to be done to ensure that the indexing service can access the .propdesc file (e.g. LOCAL_SERVICE permissions)? I copied your code to C:\RegNSE, gave LOCAL_SERVICE read permission to this directory and then gave built/registered the 2 .dlls from the solution. I rebooted my machine and completely rebuilt my index and then tried to search from the start menu but couldn't get registry items in the results.

Thanks in advance for any replies!
Coordinator
Mar 7, 2007 at 2:42 PM
1) Unfortunately, the ability to extend the property system does not also apply to advanced query syntax http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/search/wds2x/aqs_reference.asp. However, you'll notice that the property schema file has a <searchInfo> node with an inInvertedIndex attribute. This will cause the data for that property to get indexed by the Windows Search engine.

2) Yes. You have to go the the options (Right Click the Start Orb and select Properties. Then clicke the Start Menu Customize button. At almost the bottom of the list of options you'll see a Search files setting with 3 radio buttons. If you select Search Entire Index you should start seeing registry items from the start menu.

3) The Windows Search service does not need to access the .propdesc file directly. See #2 above.
Mar 7, 2007 at 5:25 PM
Thanks, Jerry. One quick clarification question: The searchInfo doc for isColumn says that this item is used "to enable end users (or developers) to create predicate based queries on the properties". If the advanced query syntax cannot be extended then what is the previous quote referring to? What queries does isColumn enable, programmatic queries?

<searchInfo inInvertedIndex=true isColumn=true columnIndexType="OnDisk"/>

isColumn
"Indicates whether the property should also be stored in the Windows search database as a column, so that independent software vendors (ISVs) can create predicate-based queries (for example, "Select * Where "System.Title"='qqq'"). If the schema creator wants to enable end users (or developers) to create predicate based queries on the properties, then this needs to be set to "true". The default is "false"."

Thanks again in advance!
Coordinator
Mar 7, 2007 at 6:00 PM
mungerer,

I am collecting some information that will address this question specifically. I hope to have it posted later this afternoon.

Thanks.

-JJ
Coordinator
Mar 7, 2007 at 9:17 PM
Edited Jun 12, 2007 at 6:19 PM
I have added a work item to this project to provide a sample for some predicate based querying over the registry.
Mar 7, 2007 at 10:44 PM
I see, thanks. A few more quickies: In one of your screenshots you search for "ShellFolder" and it returns registry keys/value items. Are these items returned because the GetChunk method returns some properties as part of PKEYSearchContents? Are only the properties that are returned as PKEYSearchContents searchable from Windows Explorer/Start menu?

Thanks again for your answers, it is nice to get some feedback and your replies are helping to shape the scope of projects outside of Microsoft.
Coordinator
Mar 8, 2007 at 1:52 AM
Edited Mar 8, 2007 at 1:53 AM
mungerer,

You'll notice an array of structs at the top of the GetChunk implementation. The struct specifies how the property is to be treated. We have specifically called out PKEY_RegistryTypeDisplay and PKEY_RegistryData to be treated as PKEY_Search_Contents. This does not mean, though, that the other properties are not being put in the inverted index. That is controlled by the property schema inInvertedIndex attribute.

-JJ
Mar 8, 2007 at 3:42 AM
Jerry-

I appreciate your help and patience. I've read the SDK doc but I'm still not clear on a few points.

What exactly makes a property searchable from the Start Menu/Windows Explorer? Simply being in the inverted index? When (or why) do you need to return properties as part of PKEY_Search_Contents?

Assume I have an IShellItem in my NSE called xxx with properties:
PropertyName1=PropertyValue1
PropertyName2=PropertyValue2
...

So if PropertyName1 is in the inverted index (as specified in the schema) a user can search for "PropertyValue1" from the Start menu/Windows Explorer and the list of results will include item xxx? But because AQS can't be extended a user can't search specifically for "PropertyName1=SomePossiblePropertyValue"?

Thanks again,
-Matt

Coordinator
Mar 8, 2007 at 6:44 AM
Matt

(glad I don't have to call you mungerer anymore)

Your understanding of the system is correct. Any search terms entered in the Start Menu or from the Word Wheel (search box in the upper right corner of Explorer windows) will generate hits from any data in the inverted index. This includes any data from properties labled as inInvertedIndex.

With respect to PKEY_Search_Contents, you can really just think of this like any other property. For the registry it's a bit of a stretch to think of any particular data as being "contents", so we just picked some that made the most sense. James can probably chime in here as I think he was involved in this decision.

Also, your understanding of the AQS limitations is correct. From the Start menu you will be able to search for property values generically if they are annotated as inInvertedIndex but you can't search for specific Property/Value pairs.

Hope this helps, and please feel free to continue asking questions. That's what this forum and sample are all about.

-Jerry