Exclude text with PropertyCriteria

Vote:
 

Hello

I need to do a specific search (specific meaning searching only one page attribute), using PropertyCriteria to be able to exclude text from the search result, ie the same way you would do it when using PageSearch.SearchQuery (for instance "+episerver -sharepoint"). Is this possible?

How would I modify this piece of simple code to apply/emulate the "-" search syntax?

pc = new PropertyCriteria();
pc.StringCondition = EPiServer.Filters.StringCompareMethod.Contained;
pc.Value = "sharepoint";
pc.Required = true; // false?
pc.Type = EPiServer.Core.PropertyDataType.String;
pc.Name = "PageName";
pageSearch.Criterias.Add(pc);
pageSearch.DataBind();

Regards, /Patrik

#35000
Nov 23, 2009 19:03
Vote:
 

Do you have other parameters in youre search. Ie searching for pages that contains parameter1 and parameter2 but shouldn't have parameter3.

Then I think you could search for the parameters that it should contain and then create a filter to filterout the ecxlude parameter. Checkout the searchdatasource webcontrol I think it does something like that.

/Per

#37838
Mar 22, 2010 14:54
* 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.