1
votes

I am trying to implement a faceted navigation search using Sitecore 7.5, Solr and Glass Mapper. Currently I am using code generation using TDS and Glass to auto-generate classes for every data template in my project. I have read tutorial 25 on the Glass Mapper site but I am very confused. The Glass tutorial seems to suggest that I need to create a completely new class to represent a search result. Let's say that I have a data template called Product. If I am building a Product Search page, ideally I would like to be able to have my search code return back a list of Product objects.

Is there any way of doing that? Or do I have to create a separate class that inherits from SearchResultItem? Seems strange that I can't use my auto-generated data classes for my search results.

1

1 Answers

1
votes

You can either edit the T4 GlassV3Header.tt template to make the GlassBase inherits from SearchResultItem. Or you can follow the "Using custom result class" section in tutorial #25 to use the generated classes directly with the search. Check out this link for more details:

https://stackguides.com/questions/28429752/sitecore-glass-mapper-tds-code-generation-and-searchresultitem