Hi I want to search only content which has a custom property (i.e. summary). Can I do this is the query? Could someone help with the syntax as I'm new to this. Cheers, Chris.
var criteria = ExamineManager.Instance .SearchProviderCollection["InternalSearcher"] .CreateSearchCriteria();
If you setup your filter to only search the summary property content, it will only return content which has this property, so, your above statement seems rather valid, although now you're also allowing to search in two additional fields.
var filter = criteria.GroupedOr(new string[] { "summary" }, searchTerm).Compile();
(Make sure your indexer is also indexing that field, otherwise no results will be returned of course)
Filter on custom properties
Hi I want to search only content which has a custom property (i.e. summary). Can I do this is the query? Could someone help with the syntax as I'm new to this. Cheers, Chris.
var criteria = ExamineManager.Instance
.SearchProviderCollection["InternalSearcher"]
.CreateSearchCriteria();
var filter = criteria
.GroupedOr(new string[] { "nodeName", "bodyText","summary"},
searchTerm)
.Compile();
SearchResults = ExamineManager.Instance.SearchProviderCollection["InternalSearcher"]
.Search(filter);
If you setup your filter to only search the summary property content, it will only return content which has this property, so, your above statement seems rather valid, although now you're also allowing to search in two additional fields.
(Make sure your indexer is also indexing that field, otherwise no results will be returned of course)
Cheers,
/Dirk
is working on a reply...