November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi,
In this case using search providers (Lucene, or even better, Find) is the right approach. But it's only on SearchManager level, you can use this code:
SearchManager manager = new SearchManager(AppContext.Current.ApplicationName);
ISearchResults results = manager.Search(criteria);
int[] resultIndexes = results.GetKeyFieldValues
resultIndexes is an array of CatalogEntryId which match your criteria. Now you can use ReferenceConverter to get content links, then load the contents.
Hope this helps.
Regards.
/Q
Thanks Quan,
The following code worked for me for converting one id.
var referenceConverter = ServiceLocator.Current.GetInstance();
ContentReference content = referenceConverter.GetContentLink(resultIndexes[0],CatalogContentType.CatalogEntry,1 ).ToReferenceWithoutVersion();
VariationContent variant= (VariationContent) content.Get();
Is above the most effiecient way of doing it?
Is there any method fo the ReferenceConverter that can take array of ids as input and return an array of content refferneces?
Thanks,
Syed
Yes, it is. The ReferenceConverter's methods (except for the one which takes code as parameter) work on memory, therefore they are extremely fast. Use a foreach and you can get content links in matter of millisecond :).
Regards.
/Q
Hi Quan,
VariationContent variant= (VariationContent) content.Get
is taking a long time to load. E.g. showing 50 variants on the page will take a few seconds to load. Any better way to conver the content link into variationcontent?
Thanks,
Syed
VariationContent variant= (VariationContent) content.Get
You're using an extension method here. To load multiple contents at once, I would suggest to use IContentRepository.IEnumerable
Regards.
/Q
Hi,
The requirement is to display products and variants inside a category where the results are paged and the user can filter results based on the facets he selects.
I found this code to find the children of a catalog node but I think it is missing the facets
The other option I am looking at is to use the Lucene search. It will give you entries and facets. The only problem I have with this model is that my catalog model requires a collection of VariationContents not entries. Should I change the model to require entries or is there some other way of directly retrieving the Variant contents by the search provider along with facets?
Another question I have is that with the VariantionContent object, I can access some of the basic information about variation but I don't see any way of retrieving the meta fields for this variantion.
Any help with these questions will be really appreciated.
Thanks,
Syed