Use the elastic tsearch package in umbraco to implement the search function

Source: Internet
Author: User
Tags umbraco

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.