Hi Ben Alexandra,
Please excuse me if I have misled you with my latest response. Let me elaborate a little bit on the two approaches we've covered so far. Starting with your initial question:
"I want to create my own usercontrol that includes various items, including your search results. I need to know what assembly your Search Results lives in and how to register and then reference it so I can add it via code
The Search Results widget's logic is in the SearchResults class of Telerik.Sitefinity.Services.Search.Web.UI.Public namespace. You can register this namespace as a tag prefix in your user control and add the SearchResults inside your user control as I demonstrated in my latest response.
On the other hand, the SearchResults widget is using a template for the public representation of its data, this is the code I provided you with in my initial response.
If you want to modify just the visual appearance of your SearchResults control, you can simply create a custom template based on the default one we're using, and then map it to all instances of the widget throughout Sitefinity, or pass it to one widget on a page. . For more information on mapping external templates to Sitefinity 4.x widgets, please check these resources:
Customizing Sitefinity 4 Controls with the ViewMap
Mapping External Templates for Sitefinity 4 Widgets
Now if you need to change the logic of the widget, you can create a custom class, that inherits from the base SearchResults and override the out of the box logic.
If you need to modify both the logic and the visual representation of the data, you can create a custom class, that inherits from the base SearchResults, implement your own logic, and then pass the customized template to the layoutTemplatePath property of the control.
Please note that when using the template only, you're missing the code-behind logic that passes data to the Repeater inside the SearchResults template, that's why you're getting no results. On the other hand if you're just using the control inside a user control, like I demonstrated in my latest response, you can either go with the default template, or specify a customized one in the control declaration like this:
%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SearchResultsCustom.ascx.cs" Inherits="SitefinityWebApp.Controls.SearchResultsCustom" %>
<%@ Register TagPrefix="sfSearch" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Services.Search.Web.UI.Public" %>
This is my custom Search results widget
On a side note, I'd like to elaborate a little bit on the SearchResults widget functionality. Since the search functionality in Sitefinity is designed to be universal for all content types(i.e. so you can include multiple content types in one search index, and then look for a keyword in the generated index for different content types) the SearchResults widget builds a query which returns a result of type IResultSet
and then binds the results of the query to a control which displays the returned results as clickable links. Each of the generated links will pass a querystring to a selected page where a ContentView widget of the corresponding type is placed (this is the default page where this content is published, you specify it for each content type when configuring the search index). Then this widget will be able to resolve and display the particular content item.
Please do not hesitate to let us know if any problems persist, or you need some more information. Maybe if you share with us the exact use case scenario that you need to implement, we can give you a more specific advice.
All the best,
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking
system and vote to affect the priority of the items