I've been struggling with this for a bit now, and I can't get my Search to actually call the my PageProviders FindPagesWithCriteria(...) method. Is there are trick besides the really simplistic example on http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-6/EPiServer-CMS-60/Page-Providers/#search (which seems to be faulty anyway)?
1. I've described my PageProvider as that it implements search:
2. I have implemented the FindPagesWithCriteria method in my PageProvider.
3. Implemented a really simple SearchPage which does it's search like this:
PropertyCriteriaCollection crits = new PropertyCriteriaCollection();
PropertyCriteria crit = new PropertyCriteria
Name = "EPi:MultipleSearch",
Value = "MyPageProvider",
Type = PropertyDataType.Boolean // not needed (?) according to EPiServer Tech Docs but returns an error without it
crit = new PropertyCriteria
Name = "MainBody",
Value = "HeyBaberiba",
Type = PropertyDataType.LongString,
Condition = CompareCondition.Contained
var pdc = DataFactory.Instance.FindPagesWithCriteria(PageTreeStart, crits); // Where PageTreeStart is the start node of my PageProvider Pages
Is there any reason, given the above, that my FindPagesWithCriteria method does not even get called?
I found the error.
After some documents searching I realise that the above linked Tech document for CMS6 Page Providers is wrong. When I compared it with the code given for EPiServer CMS5 R2 page Provider the lines for Multimple Search was different.
crit.Name = " MultipleSearch";
crit.Name = " EPI:MultipleSearch";
Noteworthy is that the space " " in the beginning of the strings is of course some error and it should not be there AND that while the rest of the world spells EPi with a small "i" in this particular instance it is essential that you use an uppercase I, Like so:
crit.Name = "EPI:MultipleSearch";
Also note that if you use the line above you will not need to have "Type = PropertyDataType.Boolean" (as I had written in my code above).
Oh well, I hope this forum post helps someone else :)
And, just for the record. As a friend pointed out to me, the text itself (not the code) actually says that you have to specify "EPI:MultipleSearch" when you want to search in. I have to admit that I saw only the code and not so much the surrounding text. ;)
Fixed, thank you!