Hi.
On my site I am searching the term "Red". I am presented with a number of results such as:
Red Felt Bag
Red Laptop Bag
etc...
But I also get results like:
Credit Card Cover
Credit Card Cover Leather
etc..
This is because the letters 'red' existing inside of the word 'credit'. How can I prevent this and simply search the whole word/term only?
Hi DesignLocker,
You can use REGEXP and the [[:<:]] and [[:>:]] word-boundary markers. For example:
You'll just need to modify the search function being called to include this expression.
Hope this helps.
- Mel
You can use REGEXP and the [[:<:]] and [[:>:]] word-boundary markers. For example:
Code: Select all
SELECT * FROM table WHERE keywords REGEXP '[[:<:]]red[[:>:]]'
Hope this helps.
- Mel
http://online.enterpriseconsulting.com.au
Site with OpenCart extensions & code downloads, many new extensions coming soon!
Follow us on twitter for more updates
Who is online
Users browsing this forum: No registered users and 86 guests