When you use the broker API, you can add all sorts of criteria to filter
One of the available criteria is the CustomMetaValueCriteria class, which allows filtering for a custom metadata string value.
It takes a couple of parameters
- the key of the custom metadata field
- the value it should filter on
- an operator like greater than, equal, not equal,...
I guess a statement like this might help you:
Criteria myCriteria = new CustomMetaValueCriteria(new CustomMetaKeyCriteria("City"), "New%", Criteria.Like);
Query myQuery = new Query(myCriteria );
string[] results = myQuery.ExecuteQuery();
Note that this query looks for any city names starting with New.
To look for city names containing New, use "%new%" instead.
The query returns a string array of tcm uris, which you can then use to retrieve the appropriate dcps.
You might need to add extra filters to specify the publication ID to look in, or to limit item types to just components, or even search for components with a specific schema ID.
More info on using the filters for the broker API can be found here (login required)
http://docs.sdl.com/LiveContent/content/en-US/SDL%20Tridion%20full%20documentation-v1/GUID-D923899D-75AA-4D73-8E79-2DFAC3D124A6