创建用于查找和匹配用户输入的网页抓取工具[关闭]

I made a website with many pages, on each page is a sample essay. The homepage is a page with a search field. I'm attempting to design a system where a user can type in a word and when they click 'search', multiple paragaphs containing the searched word from the pages with a sample essays are loaded on to the page.

I'm 14 and have been programming for about 2 years, can anyone please explain to me the programming languages/technologies I'll need to accomplish this task and provide suggestions as to how I can achieve my task.

All I have so far are the web pages with articles and a custom search page I've made with PHP. Any suggestions?

The programing language does not realy matter for the way to solve the problem. You can implement it in the language which you are comfortable with.

There are two basic ways to solve the problem:

  1. Use a crawler which creates a index of words found on the different pages The use that index to lookup the searched word

or

  1. When the user has entered the search expression, you start crawling the pages and look if the search expression is found

Of course both solutions will have different (dis)advantages

For example: In 1) you need to do a inital crawl (and udate it later on when the pages change)

In 1) you need to store the crawl result in some sort of database

In 1) you will receive instanst search results

In 2) You don't need a database/datastore

In 2) You will have to wait until all pages are searched before showing the final resultlist