Click to See Complete Forum and Search --> : Search a Site
shanuragu
06-02-2003, 04:58 AM
Hi all
I have designed a web site, I want to include search box to search info with in the web site. I have no idea as how this search works. Please give me the steps to design a search with little expalnation about the logic used behind it.
Regards
ShaRa :confused:
yardleybates
06-02-2003, 10:11 AM
How does a search like this work with asp pages? More specifically, with dynamic content. Our site is 99.9% database driven, so the actual page content is often not in the asp page folders.
shanuragu
06-03-2003, 05:21 AM
I want to search my site using meta tag. No data base tables are available. Please help.
ShaRa
cmelnick
06-04-2003, 10:10 AM
If I understand you correctly, you want to be able to search through your site and find html pages that contains the search parameters in the <meta name="keywords" /> tag.
(see this article on meta keywords tag (http://www.searchenginewatch.com/sereport/article.php/2165061) for a great article on the usefulness of these tags.)
Back to what Dave said in his first post, you are going to have to write a search engine to crawl through all the html, asp or whatever files you want to search, and search through THOSE files for your <meta name="keywords" content="key words"> tags, parse out the content values, and then search the content values for the words you are looking for.
Unless you want to hire me, I can't possibly post REAL code because this would be a in depth program that is going to take a good chunk of time. But I can outline a simplified version of what you need to shoot for:
1.) Get your directory structure using the FileSystem object (http://www.devguru.com/Technologies/vbscript/quickref/filesystemobject.html).
2.) Parse the directory for html filenames.
3.) Open those files with a TextStream object (http://www.devguru.com/Technologies/vbscript/quickref/textstream.html) and the Read or ReadLine methods.
4.) Use InStr (http://www.devguru.com/Technologies/vbscript/quickref/instr.html) or other string searching function to locate the meta tag and keyword name, and Mid (http://www.devguru.com/Technologies/vbscript/quickref/mid.html) to get your content values.
5.) Use the same string search functions to search through the contents to locate your search options. Make sure to use the compare parameter of the InStr method set to VBTEXTCOMPARE (or 1) so it will search case insensitive.