I want my search tool to have a similar behaviour to Google Search when all of the elements entered by the user are excluded (eg.: user input is -obama). In those cases, Google returns an empty result. In my current code, my program just makes an empty Solr query, which causes error in Solr.
I know that you can enter *:* to get all the results, but what should I fill in my Solr query so that Solr will return an empty search result?
EDIT:
Just to make it clearer, the thing is that when I have something like -obama, I want Solr to return an empty search result. If you google -obama, that's what you get, but if you put -obama on Solr, it seems that the result is everything (all the documents), except for the ones that have "obama"
You shouldn't query solr when there is no term being looked for (and I seriously doubt google looks over it's searchable indexes when a search term is empty). This logic should be built into whatever mechanism you use to parse the user supplied query terms before constructing the solr query. Lets say the user's input is represented as a simple string where each word is treated as a unique query term. You would want to split the string on spaces into an array of strings, map over the array and remove strings prefixed by "-", and then construct the query terms from what remains in the array. If flattening the array yields an empty string, return an empty array instead of querying solr at all.
How do I make Solr return an empty result?