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?

#27351 Jan 27, 2009 12:47
  •  

    I'll rephrase: 

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

    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"?

    #27391 Jan 28, 2009 9:18
  • Member since: 1999
     

    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.

     

    #27395 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).

     

     

    #27399 Jan 28, 2009 13:40