Searching for an item or file in list/library by ID.
Published Apr 11 2019 01:52 PM 11.4K Views
Microsoft
There are times when you may observe different behavior when searching for an item or file in list/library by ID.
 
Scenario 1: Recently we noticed that when we try to search for an item/document using the ID it no longer returns any results, or the results do not include the item/document with that ID as part of the result set.
Scenario 2: We have two tenants (one for production and one for testing) that are seeing different behavior when searching for the ID of a document. In one tenant when we try to search for an item/document using the ID it no longer returns any results whereas in the other tenant when search for an item/document with just the ID the results will include the document.
In both scenarios discussed above, the documents/items are searchable when searching using the managed property explicitly. For Example: listitemid:6 

MPexplicit.png

Why is this occurring?

Older farms were configured so that farm schema (this is different from the tenant schema and is managed by Microsoft) had the ID included in the fulltext index. This resulted in the ability of users to be do freeform search for an item/document id. In this instance it would include the item/document in most cases even though the managed property for listitemid is not configured to have this as part of the fulltext index at the tenant level.

 

mplistitemid.pngThis configuration, that was present on older farms has been modified for performance improvements and based on feedback from customer that this behavior caused unexpected results.  As a result, farm schema no longer adds the ID to the fulltext index so the you will need to explicitly search using the managed property listitemid:<ID>. As tenants are moved from one farm to another farm as part of planned capacity operations, you will experience scenario 1 that was outlined above.   For scenario 2 that was outlined above, this is due to one tenant being on an older farm and the other being on a newer farm.

 
 
How can I search for my list item without having to specify the listitemid managed property?
If you would like to return the ID without explicitly using the managed property you can take the following steps:
 
1. Go to the SharePoint Admin center
Note: We recommend making the Managed Properties that you are going to use on more than one site at the Tenant level as a best practice.
2. Go to search
3. Go to Manage search schema
4. Click on “Create a new managed property”
5. Give it a name and make sure that the following options are checked: Searchable, Queryable, Retrievable, Token Normalization

myMPlistid.png

6. Add a mapping to the ows_ListItemID
cplistid.jpg
7. Save.
 
Once you have completed these steps you will need to re-index the site collections/list/library: Manually request crawling and re-indexing of a site a library or a list. After content is re-indexed you will be able to search without explicitly using the managed property.
 
NOTE: After this change you may get unexpected result when performing numeric searches.
 
If you have any feedback or suggestions for search, please submit those suggestions to https://sharepoint.uservoice.com/. The Product Group checks the requests and feedback on a regular basis and uses this feedback for new features and enhancements to the product.
Co-Authors
Version history
Last update:
‎Apr 30 2021 12:42 PM
Updated by: