The default Textpattern built-in search only returns results from the title and body of posts. The following are instructions to make Textpattern search through post keywords as well.
- Access your Textpattern website MySQL database using phpMyAdmin and click on the Textpattern table.
- Scroll down to the Indexes table on the bottom of the page and click on the pencil on the searching value row.
- Click on Go on the bottom-right next to the Add to index [1] column(s) to add a new field. The default value for the new field which appears as a drop-down button is - – ignore – – . Click on the drop-down button and select Keywords [varchar(255)], then click on Save. You can now exit phpMyAdmin.
- Open publish.php in your website’s Textpattern folder and find the following code (lines 576 and 577 in Textpattern v4.0.5):
$match = ", match (Title,Body) against ('$q') as score";
$search = " and (Title rlike '$q' or Body rlike '$q') $s_filter";
- Change the above code to this:
$match = ", match (Title,Body,Keywords) against ('$q') as score";
$search = " and (Title rlike '$q' or Body rlike '$q' or Keywords rlike '$q') $s_filter";
Thanks to a helpful article which was pointed out to me in the Textpattern forum.