making full text search smarter |
[eluser]CroNiX[/eluser]
I'd look into Lucene by the Apache Foundation. It's a full fledged search system that has a lot of options, like returning results ordered by relevance and word proximity. Zend framework has a Lucene library, which CI can use. There are tutorials showing you how to use Zend libraries within CI. It's great and can be dropped into any project with little modification. You just need to build the index. http://framework.zend.com/manual/en/zend...cene.html/
[eluser]mikerh[/eluser]
[quote author="brian88" date="1346268361"]ahh ok. thanks. how can I only add "+" to words greater than 3 characters? Because I dont want words like "+a" or "+it" This would be easy if it was just a string( if(strlen($a) >= 3) ), but its the words are in an array...[/quote] Yep just change all the logic to this. Code: <?php
[eluser]brian88[/eluser]
thanks for the link CroNiX. hey mikerh, When using your stop words its actually replacing them inside of words i want. example. Code: $stopWords = array("a", "an", 'to', "or"); original string chuck norris ran a marathon returns +chuck +nris +mrthon
[eluser]mikerh[/eluser]
Oops sorry I didn't think of that. Keep in mind that Mysql will take care of common words when you build a full text index. Anyway to do words yourself just use some regular expressions...just modify how you see fit. just make sure to surround whole words with \b. For example if you want to remove the word cheese it would be \bcheese\b Anyway...new code! Code: <?php |
Welcome Guest, Not a member yet? Register Sign In |