London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

How can I fetch all pages with different language version by epi find query using GetContentResult() method

Vote:
 

Hi,

Can anyone help me to know  how we can fetch  all pages created with different languages version by epi find query.

My query are mentioned a s below:-

var query = SearchClient.Instance.Search().FilterForVisitor().
OrderByDescending(x => x.StartPublish).Take(1000);
var batch = query.GetContentResult();

Thanks in advance

#175910
Mar 06, 2017 13:04
Vote:
 

.FilterForVisitor() has an overload where you can pass a language.

#175926
Mar 06, 2017 16:13
Vote:
 

Hi Johan,

Thanks for your reply.. One more query i have..

If i want to mention/fetch all languages then what i should do ?

Should i pass all the languages in FilterForVisitor()???

Thanks

Sourav

#175946
Mar 07, 2017 7:03
Vote:
 

If you remove FilterForVisitor() you will probably get all language variants. If not, you can load them manually with IContentLoader after the search, please see http://world.episerver.com/documentation/developer-guides/CMS/Content/icontentrepositorydatafactory-interface1/.

#175948
Mar 07, 2017 7:53
Vote:
 

If you remove FilterForVisitor, make sure to use  .ExcludeDeleted().CurrentlyPublished().FilterOnReadAccess() instead to make sure visitors won't see content that they are not supposed to see.

#175983
Mar 07, 2017 8:16
Vote:
 

Hi Per and Johan,

Thanks a lot for your Help and suggestion. Realy i am very thankful to you for this.

Could you please tell me one more thing  how can i retrieve data with two languages ( English and swedish) from Epi find query.

My code is metioned below:

query = SearchClient.Instance.Search<PublicContentPage>().FilterForVisitor().Filter(MarketTagFilter).Filter(CategoryTagFilter)
.OrderByDescending(x => x.StartPublish).Take(1000);

thanks

Sourav

#176146
Mar 10, 2017 15:09
Vote:
 

Hi Guys,

i have a question regarding the FilterForVisitor() method. 

I am using Find to get products from Commerce Catalog.  I have products of Type TippingProducts in the catalog.  Each product can be published in couple of languages. (en, en-US, nl-NL etc). 

Now in the master language en, there are 20 products, all published.  Using the method below(without language) i get them all. 

in en-US for example of those 20, only 3 are translated and published. The other 17 i dont want to show in en-US. 

But still when calling the FilterForVisitor("en-US"), i get no results.  The same goes for FilterForVisitor("nl-NL") (no results). 

What am i doing wrong here?  I am on the latest of all packages of Find en EPi/Commerce of today. 

var query = client.Search<TippingProduct>()
.FilterForVisitor()
.Take(300);


If FilterForVisitor is not working, any other workaround to get only the TippingProducts given a specific culture?

#196903
Sep 15, 2018 13:14
* 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.