Database Search Code Feedback - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Database Search Code Feedback (/showthread.php?tid=52553) |
Database Search Code Feedback - El Forum - 06-15-2012 [eluser]brian88[/eluser] This is my first attempt at testing a search feature for a website. Its very simple and Im looking for feedback to make the search more usable without a ton of advance code. The code is simple now, Im just looking for some simple feedback to make the search a little better. Table: blog ---------------------------------------------------- | id | title | body | ---------------------------------------------------- | 1 | How to lose weight fast | a bunch of lorum ipsom text | ---------------------------------------------------- | 2 | How to hack stuff | a bunch of lorum ipsom text again | ----------------------------------------------------- | 3 | Top 10 best foods | lots of body copy about foods | ----------------------------------------------------- model Code: // get search results controller Code: function search(){ view Code: <div id='content'> Database Search Code Feedback - El Forum - 06-15-2012 [eluser]vitoco[/eluser] better in which way ??, i you want to find multiple keywords in a field, google FULLTEXT SEARCH in mysql ( i guess that's your RDBMS ). Saludos Database Search Code Feedback - El Forum - 06-18-2012 [eluser]brian88[/eluser] thanks. i found a tutorial on full text search. a query like this is better. thanks Is there a way to use the '%{$keyword}%' like in my first post with full text search? When i type in "apples" i want it to find "apple" too Code: SELECT *, MATCH(title, body) AGAINST ('{$keyword}' IN BOOLEAN MODE) AS score |