November Happy Hour will be moved to Thursday December 5th.

FindPagesWithCriteria does not match PageReference property

Vote:
 

Hi!

I've run into an issue when using FindPagesWithCriteria.
I try to fetch all pages matching a set of PropertyCriteria but in some cases I do not get the pages I would expect.

The criterion I'm having problems with is this one:

pcc.Add(new PropertyCriteria
            {
                Name = "TargetPage",
                Condition = CompareCondition.Equal,
                Required = false,
                Type = PropertyDataType.PageReference,
                Value = pageLinkToMatch.ID.ToString()
            });

    

I have created pages with this TargetPage property set to various pages, and I'm then searching for pages having TargetPage set to a certain page.

I do not get matches when TargetPage has been set to point to a page within another PageProvider (in this case the PageProvider has the Multilanguage capability only). However, when set to a page within the regular CMS it works just fine.

What am I missing?

Hope you guys can give me some pointers, because I have hit the wall.

Cheers,
Patrick

 

#66760
Mar 08, 2013 17:06
Vote:
 

Have you tried with pageLinkToMatch.ToString() instead of pageLinkToMatch.ID.ToString()?

Pagelinks to other providers also have a prefix and not just the ID to the page.

#66761
Edited, Mar 09, 2013 14:53
Vote:
 

You also need to add a special criteria to tell the function to search over all providers, please see http://world.episerver.com/Modules/Forum/Pages/thread.aspx?id=57181

#66763
Mar 11, 2013 7:55
Vote:
 

Yeah, I've tried using both just the ID as well as the entire PageLink string, no luck.

I don't get why it would be required to implement the PageProvider with Search capability when I only want to find pages within the actual CMS. A textual match would suffice.

I guess I could change the SP used in text searching to include PageReference property as well and match them that way, but I guess that has other side effects. The issue could probably be solved using a custom property as well, but I don't have the time.

I just find it odd that matching the page reference value requires searching for the page in the external page provder and fails.

Anyway, I gave up on this in the end and discarded the CMS for this feature entirely.

#67980
Mar 14, 2013 12:24
Vote:
 

The CMS can't obvious search in your provider if you're not implementing the search method. It can't know how your data looks like.

If you want to find pages that links to other pages you can use the SoftLink API.

#68030
Mar 14, 2013 18:37
Vote:
 

Yeah, I get that. But the (for me) not so obvious point is that searching in the page provider is required at all.

If I'm matching local pages on a property value, so what if that property value references a page in a different provider - it should still match.

StartPage
- Page 1 [1]
   PropertyPageReference TargetPage: "PP__101"
- Page 2 [2]
   PropertyPageReference TargetPage: "PP__102"
- Page 3 [3]
   PropertyPageReference TargetPage: "1"

[PageProvider (PP)]
- PageProviderPage 1 [PP__101]
- PageProviderPage 2 [PP__102]

Using FindPagesWithCriteria, search root in Start, with a PropertyCriteria as above (but with pageLinkToMatch.ToString() instead).
What result would you expect if pageLinkToMatch.ToString() was PP__101?

I would expect the result to contain Page 1 [1] as the TargetPage property of that page has the value of PP__101.
But now it seems that we know that FindPagesWithCriteria will require that page to be found within the provider, and as Search capability is not implemented it is considered "not found" and Page 1 will not match.

Thank you for your feedback, and I will look into the SoftLink API!

#68044
Mar 15, 2013 8:24
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.