Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-03-09 16:55:56
- ricoschette
- Member
- From: Estonia
- Registered: 2005-09-17
- Posts: 176
make default search to display only "full match"
Before using ob1-advanced-search plugin, I’d like to know if TXP default search can display in search results only full match and not partial.
That solution is for client to see his/her ordered product(s)’s status. So for every single ordered product there will be an article.
And inside of an article there’s information about the status of a product (name of a product, arrival time, payment status etc).
Now, when a client searches his/her product by typing in the search field the number given to him/her, the search shouldn’t give partial results.
For example, article name is 00256, search shouldn’t give any results for 002 or 256 or 6. Only when typed full article name – 00256.
Can it be done with default search?
Offline
Re: make default search to display only "full match"
You can probably do this by changing TXP core files, so the search doesn’t use RLIKE for search matching, but the MySQL built in MATCH instead. In /textpattern/publish.php, replace this line:
$search = " and (Title rlike '$q' or Body rlike '$q') $s_filter";
with:
$search = " and (match (Title,Body) against ('$q')) $s_filter";
Offline
#3 2008-03-09 22:22:33
- ricoschette
- Member
- From: Estonia
- Registered: 2005-09-17
- Posts: 176
Re: make default search to display only "full match"
Thank you, it works very well!
Offline