Try our conversational search powered by Generative AI!

FindPagesWithCriteria returning no results when LanguageSelector specified.

Vote:
 

Hi,

We have a multi lingual site (English and Arabic). We are using  FindPagesWithCriteria to return a filtered list of pages. The original code,

 PropertyCriteriaCollection criterias = DataFactory.Instance.FindPagesWithCriteria(this.ListingRootPage, criterias, AccessLevel.NoAccess)

returned all the correct results for english, however, does not seam to return results for arabic.

I thought this might be a language issue, especially as there where pages that didn't have arabic content. I tried to modify it to this:

  PropertyCriteriaCollection criterias = DataFactory.Instance.FindPagesWithCriteria(this.ListingRootPage, criterias,lang.LanguageID, LanguageSelector.Fallback(lang.LanguageID, false), AccessLevel.NoAccess)

This code returns no results for english or arabic.

Any ideas as to why this is causing an issue? I cannot see why this would not work?

Thanks,

 Jim.

 

#22515
Aug 07, 2008 13:27
Vote:
 

Ok, Found a work around.

 Couldn't get FindPagesWithCriteriato work specifying the language Id, so instead I added the PageLanguageID as a criteria.

PropertyCriteria criteria = new PropertyCriteria();
criteria.Name = "PageLanguageID";
criteria.Condition = EPiServer.Filters.CompareCondition.Equal;
criteria.Type = PropertyDataType.String;
criteria.Value = this.CurrentPage.LanguageID;
criteria.Required = true;
criterias.Add(criteria);

 

This seams to work fine.

Jim.

 

 

#22651
Aug 11, 2008 11:07
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.