Not sure if this is possible, but I’m wondering if there’s a way to exclude a short, specific text-string from EE search results (simple and advanced)? It appears to be easy with categories, but the EE docs reveal no way to do it with a text-string.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
July 18, 2007 6:32am
Subscribe [0]#1 / Jul 18, 2007 6:32am
Not sure if this is possible, but I’m wondering if there’s a way to exclude a short, specific text-string from EE search results (simple and advanced)? It appears to be easy with categories, but the EE docs reveal no way to do it with a text-string.
#2 / Jul 18, 2007 3:08pm
If you go into the /system/lib/stopwords.php file you will see a list of words that ExpressionEngine will ignore when searching. Would that work?
#3 / Jul 19, 2007 3:56am
Thanks, Paul. I can get that handy stopwords.php file to intercept requests for any single word, but I’m actually seeking a “phrase” blocking mechanism. I tried various wildcard characters in place of blank letterspaces in the phrase to make that happen (asterisk, period, underscore), but no luck.
By the way, the message the client browser gets when (unsuccessfully) searching for a blocked word is….
“The following errors were encountered
Your search term included common words that are not allowed to be searched.
Return to Previous Page”
Just to show you that your technical advice is directed toward a noble purpose, the only aim of this inquiry is to force the default search-failure message….
“Search Results:
Your search did not return any results.
Return to Previous Page”
....to display under all conditions when a visitor to our future site (about politics/news/satire) clicks the Search button but the pre-inserted, auto-fill phrase “Dubya’s brain” is still displayed in our Search text field. As it stands, this would only work if no one ever includes that phrase in a site post or comment. In this special case, when our auto-fill phrase isn’t found, the default search-failure message gets a laugh every time.
One could conceivably use such phrase-search blocking (maybe in concert with the EE blacklist feature) to make Paris Hilton forever disappear, if not from TV, then at least from one’s entire website. :cheese:
#4 / Jul 19, 2007 1:30pm
If you are only trying to stop them from searching the pre-inserted phrase, why do you not use a bit of javascript on the <form> tag to check if the field has that exact value and if so, stop the submitting?