Page 1 of 1

Site search with javascript

Posted: Fri Sep 05, 2008 7:44 am
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?

Re: Site search with javascript

Posted: Fri Sep 05, 2008 8:26 am
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?

Re: Site search with javascript

Posted: Fri Sep 05, 2008 1:17 pm
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.