In this blog post, we will cover the various ways to search questions in Ask Extension. The text search options can be done from either the search box or Advanced Search options in the upper right-hand corner of the questions page. So let’s get started!
We will start with what we will call “operators”. That is a fancy database term for using special characters to tell the system how to search for words and phrases.
Note: Searches apply only to the body of the questions and responses—not the question title. Also, you may need to click one of the menu items at the top of the page (My Questions, Closed…etc.) to reset/clear the search results.
Quick Reference Guide
|+term||All questions that include this term|
|+term1 +term2||All questions that include both terms|
|term1 term2||All questions that include either term|
|-term||All questions that do not include this term|
|“term1 term2”||All questions that include “term1 term2” as an exact phrase|
|+term*||All questions that contain words beginning with the term|
Any search term (OR)
This is the default search. If you want to use the or operator you simply separate the words with a space, so cherry peach will display questions that include either cherry or peach.
All search terms (AND)
If I am looking for questions related to hops in North Carolina I might try the plus operator +hops +carolina. This will give me all questions that include both works “hops” and “carolina” in the body of the question or any of the responses. I can further refine with +hops +carolina +rhizomes which would include questions that include all of those three words.
Exclude a search term (NOT)
Let’s say I am looking for questions about arsenic in water, I might try +arsenic +water, but after looking at the results I might want to exclude questions that include “well”, I could use the minus operator to search for +arsenic +water -well
Match a pattern (wildcard)
Let’s say I search +peach +ooze and I get 72 results, but if I search using a wildcard operator +peach +ooz* I get 254 results. So what did the addition of the asterisk do? An asterisk acts as a wildcard and says “give me all questions with peach and any words which begin with ooz”, so this also returns ooz, ooze, oozing.
Match an exact phrase (quotes)
You can search for any phrase by enclosing the text in quotes. Let’s say I’m looking for questions about canning sauerkraut. I might try +can +sauerkraut which returns all questions that include both can and sauerkraut in the question content. But, I might also try “can sauerkraut” which returns only questions that contain both those words in that exact order.
More Search Options
These are the most popular operators, but there are more! Feel free to read the MySQL documentation on full-text searches to experiment with more options.
In addition to using these search operators, there is also an advanced search feature in Ask Extension. You can access this feature by clicking the “Advanced” button in the upper left-hand area of the screen under the search box. Here are a few examples.
Let’s imagine I was looking for a question that was answered by Jon Traunfeld on tomato rot. I could use the and operator for tomatoes and rot, and also specify Jon as the assignee:
Be aware when you are searching for experts like this that “type ahead” uses an active database search. This may take up to 10-15 seconds for a search to complete, so you need to give it a bit of time to return an name. (You have to type at least three characters to get suggestions.)
Search Term with County
Let’s try another. If I want to see all questions with the keyword tobacco and the county is Robeson I could do this:
Please note this search will return results from any state. Further filter your results by state if the county name isn’t sufficiently unique. (Trivia: There are 31 Washington counties in the United States!)
Search Term with Creation Date
OK, let’s try one more, this time using the creation date. I would like to search for all questions that include the term “truffle” and asked between January and May of 2017:
There are lots of other options to search on in the Advanced Search box so feel free to experiment with those.
I hope this makes your ability to search questions easier and more robust. If you have any questions or suggestions please feel free to contact us at firstname.lastname@example.org.