Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+11 votes
2.2k views
in Plugins by
edited by

The Advanced Search plugin gives users the ability to find what they're looking for. The plugin got inspired by and resembles StackOverflow's search, the #1 Q&A site in the world.

How Q2A searches for posts is a bit obscure and can only be fully understood by looking at the code. In short, it matches the query string against all posts that have at least one word from the query string in the title, content, tag or even as a username. Then it ranks everything based on a fixed criteria, such as if the word is in a title it's twice as important as if it's in an answer.

The issue with the default search is that it generates a huge amount of matches and doesn't allow the user to be more specific such as only looking for words in the title of a question or looking for content within a particular tag. These issues are the ones that the Advanced Search plugin aims to tackle.

Plugin features include:

  • Filter posts by question title, tags, author or content
  • Ability to force and exclude words or tags in the results
  • Combine tag, title, content, username searches in a single query
  • New ways of filtering questions (amount of views, amount of answers, score, close status and selected answer status)
  • A Small and handy widget can be included for a quick reference
  • External users support

Here are some examples of useful searches that should give a better idea of what the plugin does:

  • tag:math square triangle - matches posts with the words square or triangle within the math tag
  • +tag:programming-language +tag:c# user:john - matches posts with both tags programming-language and c# created by the user john
  • content:break -title:car isaccepted:true - matches posts that have the word break only in the content of the post, that don't have the word car in the question title and that have an answer accepted
  • tag:electronics -tag:computing isclosed:false views:100 - matches posts within the electronics tag that are not tagged as computing, that are not closed and that have at least 100 views

If you are interested in reading more about the plugin you can check the plugin page. There, you'll find some additional features, screenshots and how to order it. You can also find a plugin demo here.

by
Nice work Garbriel, as always... :)
by
Very nice plugin! Because user to enter search syntax directly into the text box is rare, it may be more better by adding UI to generate complex search syntax with some checkbox.
As a reference for the development. Good luck.
by
a very good plugin, but not easy for users to use. I am agree with Sama55, Please provide a page for advanced search with some checkboxes, Thanks.
by
I understand what you both say and I partially share the feeling myself.

On one hand, there are two things to consider: one is that the UI will be complex if tackled specifically to allow the user not to use any operand explicitly (such as "+", "-", "tag:", etc). The other one is that StackExchange guys, owners of the #1 QA site in the world and some other of dozens too (not just IT-related sites), have a similar system with no UI, extremely similar to this plugin. They seem to have been quite successful that way and I'm pretty sure they have studied this in depth.

On the other hand, an advanced search page does not necessarily need to be enabled. So admins who want to enable that page could do so according to what they think it is better for them. So I could make that change and leave it to the admins.

In conclusion, I'll see what feedback I receive from actual users of this plugin and, if I'm requested that form I'll create it. Most likely I will not remove all possible operands as a form with 30 fields is not good either but I'd get the best from both worlds.
by
edited by
Yeah. It would be difficult to make complex syntax into a perfect UI. However, syntaxs often used by users is limited. Therefore, it may be important to provide a common search pattern. It will improve user experience greatly.

This is one UI example ...


Advanced search: textbox (Existing search box. User input search syntax direcly)

  --- OR ---

Search words:
  Search words (AND): textbox1 '+' textbox2 '+' textbox3  (Default: Empty)
  Excluded words:  textbox4 / textbox5 / textbox6  (Default: Empty)
Search conditions:
  Search title: checkbox  (Default: True)
  Search content: checkbox  (Default: True)
  Search tag: checkbox (Default: False)
  Search username: checkbox (Default: False)
  Exclude questions less of views : textbox [number] (Default: 1)
  Exclude questions less of answers: textbox [number] (Default: 0)
  Exclude no best answer: checkbox (Default: False)
  Exclude closed questions: checkbox (Default: False)
  Exclude hidden questions: checkbox (Default: False) <= Admin only?

Additional script (jQuery):
https://jqueryui.com/tabs/
https://os.alfajango.com/easytabs/

Please log in or register to answer this question.

...