Welcome Guest, Not a member yet? Register   Sign In
Best way to add a search to a website
#1

[eluser]123wesweat[/eluser]
Hi,

Should i just use google search box?

Website is just in development so no pages has been indexed yet and i like to see a preview.


Or has CI a search helper/library/plugin which i can use??

And what about a search result page? Should i make a controller search.php which loads a view???
#2

[eluser]Jelmer[/eluser]
There's no built in CI library, but there's a couple of options:

- Use SQL LIKE %searchword%, only useable for small website as it's very resource heavy
- Use SQL full text search (match against), only useable for large websites because it has strong rules (like ignoring words that appear on more than 50% of all pages)
- Preindex your website so searching can be done by simple WHERE statements and you can index everything (even what's not in the DB)

I wrote an implementation of the last option (in my sig), I would still consider it alpha but not because it's not useable. I've implemented the Dutch version succesfully with RapidDataMapper (that one is Release Candidate level) but just didn't get round to testing the English version using active record and I haven't gotten round to writing documentation. The code is pretty straight forward though, so you should be able to understand how to use it from the example controller.
#3

[eluser]Craig300[/eluser]
I had the same decision to make a few months ago and ended up integrating Zend Lucene search into my site and it works like a treat. You can index whatever you want from a database, which will make it faster. You can then set a cron job to index the site every 30mins or so, or you can run the index function every time contents is changed - its up to you really.




Theme © iAndrew 2016 - Forum software by © MyBB