Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-07-21 12:40:15

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 180
Website

Also search custom_field for search term

Maybe I am missing something but I could not quite find an answer to that. I know how it is possible to display only articles with a certain value on a certain custom_field but what I want is:

The normal search should not only look in title, body and excerpt for the search term it should also look in the custom_field. Is that achievable without a plugin or would I need to use etc_search for that?

Offline

#2 2021-07-21 14:09:26

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,683
Website GitHub Twitter

Re: Also search custom_field for search term

You need wet_haystack but I’m not sure if it still works in the later versions of txp.


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#3 2021-07-21 20:06:38

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,170
Website

Re: Also search custom_field for search term

I believe wet_haystack does still work, and if it doesn’t all you need from it is the two SQL queries it executes. wet_haystack simply adds further columns to the database table’s FULLTEXT index and then stays out of the way until you decide to add or remove another column to the index. It essentially does:

ALTER TABLE textpattern DROP INDEX searching

and then:

ALTER TABLE textpattern ADD FULLTEXT searching(Title, Body, custom_1);

or another column name in place of custom_1 depending on what content you want to be searchable in search operations. (wet_haystack uses wet_haystack as the index name rather than searching as set during textpattern installation).


TXP Builders – finely-crafted code, design and txp

Offline

#4 2021-07-22 06:11:09

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 180
Website

Re: Also search custom_field for search term

Thank you both. I can confirm that wet_haystack works perfectly fine. It looks a bit 4.2+ish though =)
And good to know that in case it ever stops working how to achieve the same thing.

Offline

Board footer

Powered by FluxBB