I do not know you do not notice when the Internet: some content-rich sites, the total built a content search engine; some large commercial websites or integrated websites are equipped with powerful web search engines, such as Sohu, Sina, Yahoo and so on. Its convenient search query function so far left people with indelible impression, you just type in the keywords you want to browse the data (such as: Web page), a "search" button, the "page" of the list of information presented in front of you; This is just the basic function of the search engine-search queries.
The author is now responsible for the construction of the Shandong (http://www.china-sd.net)-China search section, using the most commonly used development language--asp to develop the powerful function of the search engine! Below I on the main components of the search engine and some of the functions of the implementation code to explain to you, what are the deficiencies please give points!
In this chapter, I introduce the components and main functions of the search engine.
The composition of the search engine is roughly divided into three parts:
1, interface: This part is mainly customer-oriented, is the part that can be seen, such as you open search.sina.com.cn afterwards see the page.
2, Program: This part is mainly the execution of code, according to the customer's search requirements to execute code to obtain search results; These are the things we can't see.
3, the database: All the search engines are inseparable from the database, even the famous google.com is no exception; The database is the warehouse that stores the search data, the more storage, the more data will be searched, which is also one of the shining points of the search engine is strong.
So is the search engine strong and other shining points, what is it? Yes, the search engine database in the storage of more data, we can not easily find a search, or even find the necessary information, then the database is "dead", useless, so the program code plays a very important role.
Here, I should give you some of the main features of the search engine:
1, search query: There is no doubt that this is the most basic function, according to the keyword to find the relevant information to match the keyword.
2, pagination display: If you're searching for a lot of information, put it all on one page, and that feels like a mess. Pagination shows that according to People's habit of reading, part of the content on the first page, the other content on the second page, the third page and so on.
3, search statistics: generally include the number of inquiries, several pages, each page contains several materials, the current page data range and so on.
4, search results arrangement: Search Rankings I think we will not be unfamiliar, these are integrated web search engine to earn money, which is also a powerful search engine indispensable functions, such as according to the number of clicks, according to the ranking, according to the rank of the ranking.
5, a number of keyword query: "If you want to find information containing multiple keywords, you can use the space to separate the key words" This is the Sina search engine layout in a paragraph of text, in a text box to hit multiple keyword search query information.
6, the overall statistics: This is the search engine opened to date some data statistics, including the "Hot query keyword" Statistics, the database in the overall statistics, each category contains data statistics and so on.
The above functional code mainly according to the author's request to write, you can write in my code to make changes to become your own needs of the functional code.
Well, after a section of the warm-up, we can also enter the actual combat phase, first, we build a database, as the data storage, here I will be the database file name Information.mdb, use Access to create a database, of course, you can also use SQL Server to create.
4, key table: keyname---Keywords; number of keyhot---
Using ASP to establish a connection with the database: conn.asp
Description: The path represented by Server.MapPath () is the relative path of the file, where I conn.asp and Information.mdb are in the same directory. I think these are very simple, we are very easy to understand and accept! Well, when we build the database, we can build powerful search engines. Please look forward to Oh! Xi Hee ~ ~ ~ ~
Using ASP to make powerful search engine--fuzzy search
According to a keyword, search for relevant information, where "related" refers to the data has similar to this keyword string. For example: "Shandong" this keyword, as long as the data in the database contains "Shandong" the key word to find them out. The application of fuzzy search is actually very simple, as long as the use of a SQL statement can be implemented, let's look at the wording of his statement.
In SQL syntax you will find such a few judgment words: like, not like, and BETWEEN. The like decision word is a very useful symbol. However, in many cases it may give you too much data, so it's a good idea to think about what data you want to get before you use it. Not-like is the opposite of the way to do. Between suppose you want to take out a certain range of data, and you know the beginning and end of the range, then you might as well use between to judge the word. These judgment words are used according to different environment, the most commonly used is like and "%" combined.
Dim Sql,key
Key=request ("key")
Sql= "SELECT * from www. Where sitename like '% ' &key& '% ' or FAQs like '% ' &key& '% ' or key like '% ' &key& ;" %' "
Description: The purpose of the SQL statement here is to retrieve whether the SiteName field in the database contains the Key,faq field containing the key in the Key,key field, so that the scope of the search is included in the site name, site brief description, site keyword. If you only want to search for keywords just use sql= "select * from www where key like '% ' &key& '% '" is OK. "Like" is used "or" to connect, "or" "or" means that, regardless of which kind is eligible, the search data output should be displayed.
OK, now it's not necessary to see if you can perform or say the results of the execution, because most of the search engine functionality is done by writing the SQL statement. And so I put the other related SQL statement function implementation after introduction, we look at the effect, hehe! Don't worry!!
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.