Requirement: Add a new property to the advanced search drop-down in SharePoint Online.
SharePoint Online: How to Add a Property to Advanced Search Drop Down?
To perform search queries based on a specific column value in SharePoint, we can use “Advanced Search”. By default, you can search against any managed property, such as “Author:Some Name” in SharePoint. SharePoint Online advanced search properties drop-down with default values such as “Created by”, “Name”, “Size”, etc. To add your custom column to this drop-down, follow the below steps:
Step 1: Get the Managed Property to add to advanced search properties
We need the metadata column created as a managed property in order to list it in the advanced search page properties drop-down. Unlike SharePoint On-premises, SharePoint Online automatically creates a managed property for Site Columns during crawling if the column has values in it!
Edit the automatically created managed property to map additional fields and set an alias for the managed property. You may have to create a new managed property by mapping existing crawled properties, if not listed on this page.
Step 2: Edit Advanced Search page and Add Managed Property to the Schema
The Properties popup page gives XML schema for all properties listed on the Advanced search page. Copy-paste it to any XML editor as it would be easier. Here I’ve copied the schema to an XML file, opened it in “SharePoint Designer” and re-formatted the code for better usability.
Add the entries to <PropertyDefs> and in <ResultTypes><ResultType> nodes
Now, You should see the new column added to properties drop down in Advanced Search page!
Wait for the “Crawl” to run on your SharePoint Online site (or reindex the list or library manually), and you can perform search queries based on the custom property.
Here is another article for SharePoint On-Premises: Adding Custom Properties to SharePoint Advanced Search