[IE8] use ASP to develop visual search for your platform)

Source: Internet
Author: User
ArticleDirectory
    • Information used by Alibaba Cloud
    • Opensearch. xml
    • Search for the Program: results. asp
    • Suggestion. asp
    • Join the visualized Search Engine
    • Conclusion
Starting from

Friends who have seen this topic may feel like they have known each other. No. After [Internet Explorer 8] search engine function Introduction] and [Internet Explorer 8] Development of visual search for your platform, you can use [Asp. net] You have developed visual search. However, more than half of Meow's systems are still in the [Asp] architecture. Before the upgrade of these systems to ASP. NET, they also hope to use [Asp] to develop visualized search engines. So the focus of this article is how to use [Asp] to develop a visual search.

Required marker

From the previous article [[IE8] Developing visual search for our own platform] We can know that we want to develop visual search, you need to specify the following items

    • 1. Information used by zookeeper:
    • 2. opensearch. xml: used to describe the Response Surface of the search results, the intent surface of the sensory search proposal, and the domain name of the search.
    • 3. Result. asp: displays the result of the search.
    • 4. suggestion. asp: the ultimate search engine !! The ability to perform visualized search depends on the XML results of this product.
    • 5. Security token-based search: Security token-based search
Information used by Alibaba Cloud

Here, we use the information from the previous article as the source for data. For more information, see the following.

Opensearch. xml
<? XML version = "1.0" encoding = "UTF-8"?> <Opensearchdescription xmlns = "http://a9.com/-/spec/opensearch/1.1/"> <shortname> topcat ASP example search </shortname> <URL type = "text/html" template = "http: // [serverip or servername]/[projectname]/results. asp? Model = {searchterms} "/> <URL type =" application/X-suggestions + XML "template =" http: // [serverip or servername]/[projectname]/suggestion. asp? Model = {searchterms} "/> <Image Height =" 16 "width =" 16 "type =" image/icon "> HTTP: // [serverip or servername]/[projectname]/topcat. ICO </image> </opensearchdescription>

In this case

    • [Serverip or servername]: set this parameter to your own server region.
    • [Projectname]: set this parameter to your project name.
    • Sortname
    • The first URL: The program 【Results. asp], Through the {searchterns} volume to search for content, she is a Web site, so type = "text/html"
    • The second URL: The program for checking the result of searching for XML 【Suggestion. asp].
    • IMG: Set the display of the search criteria.

Search for the Program: results. asp

Next, let's take a look at the program that found the result. In fact, this is a general web hosting ASP, and there is no special way. Determine whether the model is imported. If there is any imported data, RS displays the result from the data preview on the dataset.

<% @ Language = "VBScript" codePage = "65001" %> <! -- # Include file = "getrs. ASP "--> <% response. charset = "UTF-8" 'restrict the use of Unicode encoding to show model = ucase (request. querystring ("model") If Model <> "" Then sqltxt = "" sqltxt = sqltxt & "select top 10 *" sqltxt = sqltxt & "from T1 (nolock) "sqltxt = sqltxt &" where model like '"& Model &" %' "set rs = getrs (sqltxt) 'Call the function in include to retrieve recordset end if %> <HTML> Suggestion. asp

Next is the focus of this Article. To use the visualized search engine, the most important thing is to generate xml and follow the prescribed format (XML search suggestions format specification) production. For more information, see the following examples:

<% @ Language = "VBScript" codePage = "65001" %> <! -- # Include file = "getrs. ASP "--> <% model = ucase (request. querystring ("model ")) 'obtain the token. If Model <> "" Then sqltxt = "" sqltxt = sqltxt & "select top 10 *" sqltxt = sqltxt & "from T1 (nolock) "sqltxt = sqltxt &" where model like '"& Model &" %' "response. contenttype = "text/XML" 'specifies that the callback type is XML response. write ("<? XML version = '1. 0'?> ") Response. write ("<searchsuggestion xmlns = 'HTTP: // schemas.microsoft.com/search/2008/suggestions'>") response. write ("<query>" & Model & "</query>") response. write ("<section>") response. write ("<separator Title = 'my visual suggestions '/>") response. write ("") set rs = getrs (sqltxt) if not (RS. bof and Rs. EOF) Then Rs. movefirst for y = 1 to Rs. recordcount response. write ("<item>") response. write ("<text>" & RS. fields ("model "). value & "</text>") response. write ("<URL>" & RS. fields ("url "). value & "</URL>") response. write ("<description>" & server. htmlencode (RS. fields ("Description "). value) & "</description>") response. write ("<Image Source = '" & RS. fields ("IMG "). value & "'alt = '" & RS. fields ("model "). value & "'width = '000000' Height = '000000'/>") response. write ("</item>") rs. movenext next end if response. write ("</section>") response. write ("</searchsuggestion>") end if %>

In practice, the program is not running. The main reason is to set the response type to XML 【Response. contenttype = "text/XML"] The rest is to write the XML content response. Write.

Join the visualized Search Engine

Finally, use an HTML tag to add this graphic search engine.

 
<HTML xmlns = "http://www.w3.org/1999/xhtml">  
Conclusion

The most important part of the visualized search is the suggestion of the production project. ASP, as long as you know that the product is generated according to the specified format and specify its format, it will not expire. After this change, I wrote an article using ASP. As long as you can generate the expected XML, the actual use of Asp.net, ASP, PHP, JSP ,... It shouldn't be difficult. Here is the example provided by meow. If you have any questions, please leave a comment. Pai_^

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.