FindTemplate.aspx.cs |
|
---|---|
|
|
Create a "fresh" search request by redirecting to the CurrentPage's URL with the entered search query in the query string. |
|
Show the entered search query in the input and execute the search. We only want to do this if the page isn't post back (the user hasn't pressed the search button) as we would otherwise ignore what the user has entered in the text box. |
|
This is where the magic happens. We built up a search query based on query string parameters, execute it and populate the Results property which is then displayed in the ASPX markup. |
|
Create a search/query for the entered search text retrieved from the query string. |
|
By default multiple words in the text entered by the user will be ORed, meaning that a search for Alloy Tech will be treated as Alloy OR Tech. Here we allow editors to instead use AND. |
|
Include a facet for sections. |
|
Include a facet whose value we can use to show the total number of hits regardless of section. The filter here is irrelevant but should match everything. |
|
Fetch the specific paging page. |
|
Allow editors (from the Find/Optimizations view) to push specific hits to the top for certain search phrases. |
|
If a section filter exists (in the query string) we apply a filter to only show hits from a given section. |
|
We can (optionally) supply a hit specification as argument to the GetResult method to control what each hit should contain. Here we create a hit specification based on values entered by an editor on the search page. |
|
Execute the query and populate the Result property which the markup (aspx) will render. |
|
Property set by the Search method. Used as data source for the markup. |
|
Retrieve the search query from the query string. If no such parameter exists we want to search for everything. |
|
The number of search hits to show in each result listing. By retrieving it from a property on the page we allow editors to control it. |
|
Retrieve the paging page from the query string parameter "p". If no such parameter exists the user hasn't requested a specific page so we default to the first (1). |
|
Calculate the number of paged result listings based on the total number of hits and the PageSize. |
|
Retrieve section filter from query string parameter, if any. |
|
Create URL for filtering by a specific section. |
|
Create URL for a specific paging page. |
|