1

I used fulltext index in a column in my table.

Here is simple html.

<form>
<input type="text" name='search' placeholder="Enter your search" id="input" onKeyUp="update()" onChange="update()"  autocomplete="off" >
<input type="text" style="display: none">
<input type="button" name="tp" id="tr" value="search" >
</form>

I searched in database using ajax. When i just typed a character it fire off the function update() because of onKeyUp event in search input. But it doesn't fetch any data from the database until I typed a fulltext (meaning like 'hemant' ). I want to fetch the data when i just type (even a single character), I don't want to use LIKE keyword to use because it doesn't allow me to search in two or more column and also it doesn't give me nearby words option.

$sql = "SELECT * FROM data WHERE MATCH (name, email) AGAINST ('$search') ";

I also want to know that by using fulltext index. Does it search fast?

ficuscr
  • 6,975
  • 2
  • 32
  • 52
Hemant Parihar
  • 732
  • 1
  • 6
  • 19
  • possible duplicate of [Differences between INDEX, PRIMARY, UNIQUE, FULLTEXT in MySQL?](http://stackoverflow.com/questions/707874/differences-between-index-primary-unique-fulltext-in-mysql) – Jessica Jul 30 '15 at 19:20
  • Do not confuse the term `FULLTEXT` with searching on a whole word vs string fragment. Is has nothing to do with that. In this context it describes the type of index used for the column, i.e. specific to `MATCH() / AGAINST() `. Sounds like you just need to use two `LIKE` statements in your criteria, typical auto complete scenario.... – ficuscr Jul 30 '15 at 19:27

0 Answers0