Search with PropertyCriteria and multiple words


When using a PropertyCriteria with StringCondition set to StringCompareMethod.Contained - are words in the string contained by the Value property searched as a phrase, or is each word in the string searched seperatly?

EPiServer.PropertyCriteria criteriaDesc = new PropertyCriteria(); criteriaDesc.StringCondition = StringCompareMethod.Contained; criteriaDesc.Required=false; criteriaDesc.Type = PropertyDataType.LongString;  criteriaDesc.Value = tbxFreeText.Text;  criteriaDesc.Name = "Description";

I want to let the user enter a couple of words into a textbox, and then search for all pages that have a property that contains those words (but not neccessarily as a phrase).

Do I need to split the string containing the words first? Do I need a PropertyCriteria for each word, or is it possible to specify a list of values for a PropertyCriteria with Type set to PropertyDataType.LongString?

Jan 27, 2009 12:47

I'll rephrase: 

PropertyCriteria criteriaDesc= new PropertyCriteria();
criteriaDesc.Value="word1 word2"

Will this only find pages where the property "Description" contains the exact phrase "word1 word2" or will it also find pages where Description is "word1 bla bla bla word2"?

Jan 28, 2009 9:18

PropertyCriteria/FindPagesWithCriteria has no free text search capabilities so you will get all descriptions with the extact string "word1 word2".

Look at the search template in EPiServer on how to use the keyword searching capabilities in CMS.


Jan 28, 2009 12:19

Thanks for your reply.

(FindPagesWithCriteria was allready used in an existing solution, in which the searchfunction is soon to be replaced by an external indexed search).



Jan 28, 2009 13:40
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.