4

I'm making a command line tool that allows end users to query a statically-schemed database; however, I want users to be able to specify boolean matchers in their query (effectively things like "get rows where (field1=abcd && field2=efgh) || field3=1234"). I did Googling a solution, but I couldn't find anything suitable for end users--still, this seems like it would be a very common problem so I suspect there is a standard solution.

So:

  1. What (if any) standard query "languages" are there that might be appropriate for end users?
  2. What (if any) de facto standards are there (for example, Unix tools that solve similar problems).
  3. Failing the previous two options, can you suggest a syntax that would be simple, concise, and easy to validate?
weberc2
  • 258

1 Answers1

2

This is called faceted search. There are tools like Solr that can help you do it, but you don't want to use a language unless your users are highly technical (like consumers of a web service API), in which case you just use something SQL-like.

For inspiration on user interfaces, look at search results of companies with huge product lines, like Amazon or Digikey. Basically after you start a search you are presented with a list of parameters by which you can refine your search, allowing you to drill down until you get the products you want. This kind of interface is probably so familiar to you that you may not even have realized you were effectively querying specific fields of a database.

Another example of end user searching based on many fields is bug tracking websites. They generally have a general purpose GUI-based search, and also a SQL-like query language for advanced searches. If your users are technical or semi-technical, that might be a good model to follow.

Karl Bielefeldt
  • 148,830