Monday, October 20, 2014

Look up item based on the Item’s ID

If you kick off a search query you get some default properties with a document. One of these are DocId.


The managed property DocId is of type text and marked as searchable, and you would assume you a search like DocId=123456 will bring back a result back.


For some reason this does not work. The workaround however is easy.

There exists a managed property called WorkId which is also returned per result, but it’s not visible in the search schema. This property is of type integer with the same value as DocId and you can bring back one item with the following query:

WorkId:123456 or WorkId=123456

You can also do WorkId<>123456 or -WorkId:123456 if you want all items except one item in particular.

Alternatively you can map the crawled property ows__dlc_DocId to a managed property of your choice and use that instead, but no reason to do that since another solution exists.