Site search with javascript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Site search with javascript

Post by Sindarin »

Here's the problem. I have a client which has a rather old site with many html articles. He wants a search engine and as the articles are not in a database, I'll have to forget sql. :( I tried to find a search javascript but everything I found so far are javascript files taking keywords from text files but not scanning the site for keywords. Any help?
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: Site search with javascript

Post by jayshields »

You'll be better of using PHP for this I think. You'll probably have to use file_get_contents() and then a nifty regexp to grab the article content. Then you can use strpost() or something of that nature. If there are many articles then this option will be very slow. You'd be much better off putting the stuff in a database first, why not look into SQLite?
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: Site search with javascript

Post by kaszu »

I bet your client website is not on Zend framework, but Zend_Search_Lucene can be useful in this case, because it uses file storage to save search index. From experience i can tell that it's fast and it offers good configuration options. My suggestion is to take Zend framework and remove everything which is not needed for Lucene (i don't know if it's allowed by license, so check before doing it).
And then you can set up cron to reindex content every night or something.
Post Reply