Objective: To use the effectsearch package in a website for search
Implementation result:
First, download the elastic tsearch package (online installation is not required, I downloaded it locally), and install the elastic tsearch package as prompted in developer> packages> install local package, the result after installation is as follows:
Installed packages: displays installed packages
After installation, several files are automatically generated: XSLT file, macros (macro), document type, template, and content. A page named search is generated in the root directory.
Call the search file to implement the search function.Code:
Call/search. aspx in action.
The get method is used by default. Here we can change it to the post method, for example:
<Form method = "Post" Action = "/search. aspx "class =" site_search "> <fieldset class =" site_search "> <label for =" Search "> Search </label> <input type =" text "name =" Search "id =" Search "/> <input type =" Submit "value =" Search "/> </fieldset> </form>
Note: Here is a place to be modified according to the actual situation.
Is to view the generated actual elastictsearch template page, the content of which is as follows:
Modify the value based on the actual contenplaceholderid on the masterpagefile template page.
TIPS:You can easily insert this ID without looking at the template. You can easily select the ID by clicking the icon in the toolbar of the elastic tsearch template.
Select ID
You can add the search function on the required page by following the preceding method. However, if you want to search again on the search result page and click the "Search" button, you will find no response, the reason is that the <form> label is not added when the xsltsearch macro is referenced on the xsltsearch template page. Modify the elastic tsearch template page, for example: