Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How do I use exact search without quotation marks?
![About](https://secure.gravatar.com/avatar/27de5ea1c338efaddd9c07b81f219eef/?default=https%3A%2F%2Fvanillicon.com%2F8272bc4ff9e2794fc94e7e768d4a803c_100.png&rating=g&size=100)
People can search for exact words in a post by putting them in quotation marks "like this", but how do I make it so people don't have to put a post in quotation marks to get an exact search?
I just need to make exact search the default search so people don't have to use quotation marks.
Tagged:
0
Comments
You could hook into the searchModel_search_handler and modify the search query to be wrapped in quotes.
Seems pretty hackish though.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Alright but which file do I put that code into?
Sorry for not explaining myself. Put the hook in a new plugin.
/plugins/ForceExactSearch
/plugins/ForceExactSearch/class.forceexcactsearch.plugin.php
In that file, paste the following:
Enable the plugin via your dashboard.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
It's not working for me for some reason. I enabled the plugin but when I search for something the quotes don't show.
The quotes shouldn't show, it should be transparent to the user since we are dealing with the model.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Sorry I mean that it doesn't add the quotes to the search.
Like try making two topics and put https://www.google.com/#q=test in the first topic's body
and https://www.google.com/#q=test2
in the second topic's body.
Then search for https://www.google.com/#q=test
It shows both topics in the search.
But if I search by adding the quotation marks manually like "https://www.google.com/#q=test"
then it shows only one topic. How do I make the plugin automatically add the quotes to the search?
Can anyone help with this?
https://github.com/vanilla/vanilla/blob/2.1/applications/dashboard/models/class.searchmodel.php#L109
Looks like there is a reference missing![:/ :/](https://open.vanillaforums.com/plugins/emojiextender/emoji/little/confused.png)
I guess the same could be achieved by manipulating the form data.
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS