Loading...

All project content is available for reading, but you need to be a member of the project for Subversion checkout of source code, or to create/modify any information.
Login if you are a member. Apply here to request membership (open to all).

Ticket #192 (new defect)

Opened 8 years ago

Last modified 8 years ago

FindPagesWithCriteria and Globalization

Reported by: oyvind@… Owned by: andyturl@…
Priority: critical Component: EasySearch
Keywords: Cc:

Description

When indexing EPiServer pages i see that some pages are indexed with page version as well as the id (f.ex 211_2629). When doing FindPagesWithCriteria and returning pagedata objects with DataFactoryHelper.GetPage and passing the version and language selector the language selector is not used since the page version is for a specific language version.

Since the selector is not used you will get a mix of languages in the pagedatacollection.

So, why do the index store the id with the version in it ?

A workaround would be to change the parameter to the GetPage and remove the version so that the language selector is used.

See the attachment.

Attachments

11.02.png (29.1 KB) - added by oyvind@… 8 years ago.
GetPage returns wrong language version.

Change History

Changed 8 years ago by oyvind@…

GetPage returns wrong language version.

comment:1 Changed 8 years ago by andyturl@…

Hi Oyvind,

The reason that the version ID is sometimes indexed along with the ID of the page is that in order to support different page providers, when indexing a page we index the PageReference from PageLink.ToString().

When performing an index of the whole site this returns the Page ID on its own and not a specific version, however when a single page is edited and then reindexed, PageLink.ToString() returns "Page ID_Work ID".

From reading this http://world.episerver.com/Templates/Forum/Pages/Thread.aspx?id=35269&epslanguage=en it looks like this is actually a bug in EPi so we might need a work around for using GetPage().

Cheers

-Andrew Turley

comment:2 Changed 8 years ago by oyvind@…

Yes, seems like EPiServer prioritize the version id of the page reference instead of the language selector.

I added this workaround locally because i'm going live with CMS5.

PageReference rawPageId;

if (PageReference.TryParse(pageId, out rawPageId))
{
  if (rawPageId.IsAnyVersion() == false)
    rawPageId = new PageReference(rawPageId.ID);

  PageData languagePage = DataFactoryHelper.GetPage(rawPageId, selector);

  if (languagePage != null)
  {
    pdc.Add(languagePage);
  }
}

Looks like this does the job as a workarond.

comment:3 Changed 8 years ago by andyturl@…

The code looks good, unfortunately I don't think I can check it in for use due to it relying on the PageReference.ID which may not always succeed when using different page providers.

I will add this code within the method however but leave it commented out for others using CMS 5 who know they won't be using a different page provider to make use it if that's okay with you.

Since FindPagesWithCriteria is just a convenience method for FindLuceneDocuementsWithCriteria then it could also be used externally when building the Pages collection.

Cheers

-Andrew Turley

Note: See HelpUser/Tickets for help on using tickets.