Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Hooking up search to a PageProvider

Vote:
 

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:

<add

name="MyPageProvider"

type="MyCompany.Core.PageProviders.MyPageProvider"

entryPoint="191"

siteID="101"

capabilities="Search, MultiLanguage"

iconPath="external.gif" />

 

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

};

crits.Add(crit);

 

crit = new PropertyCriteria

{

Name = "MainBody",

Value = "HeyBaberiba",

Type = PropertyDataType.LongString,

Condition = CompareCondition.Contained

};

crits.Add(crit);

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?

 

#47175
Jan 18, 2011 13:18
Vote:
 

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.

CMS6:

crit.Name = " MultipleSearch";

CMS5 R2:

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 :)

#47181
Jan 18, 2011 13:46
Vote:
 

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. ;)

#47185
Jan 18, 2011 15:03
Vote:
 

Fixed, thank you!

#47188
Jan 18, 2011 16:29
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.