Pre-defined URLs search script?

by 4 replies
5
I would like to take a pre-defined list of URLs and make them searchable by keyword(s).

In other words:

Using an HTML page...

"keyword" in search box, press Find, program searches through a bunch of existing http:// addresses for that keyword or phrase, then returns the found results in a clickable list via an HTML results page.

Could this be done via a php script or a search engine api or other interactive tool?

If anyone could possibly point me in the right direction or know of such an animal (script), that would greatly appreciated!

Thank you!
Charles
#programming #predefined #script #search #urls
  • Is that predefined list of URLs provided by google or you? If you were to build the list yourself, one of the ways is to make a script to scrap the contents from those URLs (sort of like a mini crawler) on a daily-basis (it's up to you), and dump them to a database table that stores fields like url, page_content, page_title, date, etc. Open source databases like MySQL and PostgreSQL let you search for the records that match a given keyword/pattern.

    Full text search support in database is relatively slow compared to a dedicated full text search engine. You might want to look into software such as Apache Lucene if performance is the main concern, you then have to explore terms like stemming, indexing and stopwords.
  • Where are these Urls at? Are they stored in a Database, on a static Page on your server, or generated Dynamically on the fly?

    You've got multiple options. One is jQuery's .find() command. You can use that to search through all the elements in the DOM and return them all on a search, and since its an asynch call you can put out results without refreshing the page.

    If the URLs are stored in a database, you can use the LIKE command in SQL statements to find matching URLs. Here's a clip I use for people searching for domain names on my network:
    Code:
     = "SELECT * FROM `ud_Domains` WHERE `Domain_Name` LIKE '%term%' AND `User_ID`=0";
    If they are generated dynamically, you could still use the jQuery method, or you could go ahead and parse down the list using PHP when someone does a search, but that would require more overhead processing than is really called for.

    Hope that Helps!
    • [1] reply

Next Topics on Trending Feed