How to search in Stack overflow?

0
1038

The most useful and well-known source for developers is Stack Overflow. It is used by millions of users every day to get quality answers to their questions. What makes Stack Overflow a special community is there active users who not only use Stack Overflow to solve their problems, but also help users who are having trouble finding a solution to their problems. By helping developers and technologists write a vision for the future this public platform is considered one of the most popular websites in the world. This article represents search possibilities of Stack Overflow.

To begin with, a user needs to enter the search term in the search box that appears in the center-left of the list at the top of each page and press Enter (www.stackoverflow.com). On a small screen, he may first need to enable the search button magnifying glass icon to show the text box.

Search in Stack Overflow

The best way to search for a question is by doing an advanced search and the way to do it is explained below:

  • To search within a specific tag (-s), it is needed to enter them in square brackets: [admin] seat searches for “seat” references within the “admin” tag;
  • To look for a precise expression, it is needed to enter it in quotation marks: “java”;
  • To limit the search to just the title of the question, it is needed to use the query title:  Java;
  •  Similarly, to find the body with the question, the query body (excluding title): “phrase here” is used;
  • To search inside a block of code, the query needed to be used is code: x=y-1;
  • To search only the code content, the query needed to be used is code: if (a==b);
  • To search a word in the code, it is needed to use the query “valid”;
  • To search for specific questions, this query is used user: java, that searches in all user questions for the word “java”;
  • To exclude a result from a tag/term/phrase in the search query a prefix is needed, for example, Java and Spring framework – Spring MVC, so this query is searching for questions related to Java and Spring framework without including one of the modules of Spring which is Spring MVC;
  • Also, another way to find a question is to use a wildcard search by adding an asterisk anywhere in the words exc*ion or fi*al.

So far, general information regarding advance search was explained. Every user should know this information to be able to find what they are looking for, but Stack Overflow also offers an even more advanced search option to help users to find the right question:

Range Operators

Users can enter top or bottom parameters or categories to search only for questions that fall into a particular category for a score, several answers, or several views. For example

score: -2 or score: -5 will both return only questions that have greater than or equal to -2 scores.

Another way is to find a question is by views: views: 5k…20k, this will find only those questions that are between this range of viewers. And the last way from this category is by using the answers: answers: 3, this query will find only questions which have 3 or fewer answers.

Dates

Similarly, to range operators, a specific date or date ranges can be used to find the question that the user is interested in. Also, it is possible to use the operators created and lastactive, whose function is understandable from the name. To use them correctly, it is necessary to enter the dates in the correct format:

By using absolute dates:

  • range of years created: 2020…2021 – this query will return all the questions that are created from 1 January 2020 – 31 December 2021;
  • only the year: created: 2020 – this query will return every question that was created during this year from 1 January 2020 – 31 December 2020;
  • year and month created: 2020-04..2020-05 – this query will only return questions that were created from 1 April 2020 – 31 May 2020;
  • day, month, and year lastactive: 2020-04-03 – this query will return all questions that were the last active between 12:00 AM on April 3, 2020, and 11:59 PM on April 3, 2020.

     By using relative dates:

  • Users have the option to search back in time. If now is February 2021 and a user uses the query created: 1y, the query will return all the questions from the year 2020.
  • The concept is the same for the query created: 1m. It will return all the questions from January1-31 2021.
  • Furthermore, the query created: 1d will return all the questions asked yesterday.

One last thing to remember when using the dates is that the time is recorded in UTC.

User operators

By using these operators, the user will limit the search for the questions to one specific user only:

  • If a user wants to search his questions, the user can use this query user: mine or user: me, or in case the user wants to search for another user’s questions, he can use the query user: id and this will return all the questions that a specific user has asked.
  • If a user wants to search for a bookmarked question, the query inbookmarks: mine can be used and to search a specific user’s bookmarked question, the query needed is inbookmarks: id.
  • The last option is to use the tags. By using the query intags: mine, the user will get all the questions that will match his favorite tags.

Boolean Operators

Boolean operators have indeed a tremendous usage. These operators can be used with values (1/0 or true/false or yes/no). Regarding this report, the values that will be used are true/false.

  • To find all the questions which have an accepted answer (the user has an answer for his question), the query hasaccepted: true is used, and to get all the questions that have no answer, the same query is used with a false value: hasaccepted: false.
  • To find all the questions which contain code, it is needed to use the query hascode: true. If false, questions without code will be returned.
  • To find all the questions that have an accepted answer with at least one positive upvote (when other users give their vote, this usually happens when the same answer has helped them solve their problem), it is needed to use the query isanswered: true. If the value is false, the result will be all the questions which have an answer but don’t have any positive upvote.
  • To find all closed questions, the query closed: true needs to be used. If the value is false, all closed questions are excluded.
  • To find all the duplicate questions, the query needed to be used is duplicate: true. This returns all the questions which have been reported as a duplicate of another question. If it is false, those questions are excluded.
  • To find a question that has been moved to another site, it is needed to use the query migrated: true. If false, those questions are excluded.
  • To find all locked questions, the query locked: true needs to be used. If false, those questions are excluded. (Lock questions are questions in which no action is allowed (like edit, vote, answer, comment).)
  • To find the questions that have a notice, the query hasnotice: true is used. If it is false, the questions that have no notice will be returned.
  • To find the questions only from a Wiki, the query wiki: true needs to be used. If false, all the non-Wiki-community questions will be returned.

OR Operator

  • It is used to combine tags: the query closed: true or locked: true will find closed or locked questions.

Deleted Question

Stack Overflow uses a gamification system which sometimes is very important to gain different rights, as it is in the case of this operator. The user needs 10,000 reputations/points to use the queries below:

  • To find deleted questions, the query needed is deleted: 1.
  • To find deleted and not-deleted questions, the query used is deleted: all.
  • To find non-deleted questions, the query used is deleted: 0 but it is also possible to use the query user: me.

References

Overflow, S., n.d. stackexchange. [Online]
Available at: https://math.stackexchange.com/help
[Accessed 18 03 2021].

stackoverflow, n.d. How do I search?. [Online]
Available at: https://stackoverflow.com/help/searching
[Accessed 18 03 2021].

stackoverflow, n., n.d. stackoverflow.com. [Online]
Available at: https://stackoverflow.com/
[Accessed 25 02 2021].