Good luck on that <G>.... If you allow free-form input, bad queries are just going to happen. To prevent this from getting to Solr, you essentially have to reproduce the entire Solr/Lucene parser. So why not just let the parser to it for you and present some pretty message to the user?
The other thing you can do is build your own "advanced query page" that guides the user through adding parentheses, ands, ors, nots, fuzzy, all that jazz, but that's often really painful to do. But other than making a UI that makes it difficult to make bad queries or parsing the query, you're pretty much stuck... Best Erick On Fri, Jan 20, 2012 at 2:52 PM, Dipti Srivastava <dipti.srivast...@apollogrp.edu> wrote: > Hi All, > I ma using HTTP/JSON to search my documents in Solr. Now the client provides > the query on which the search is based. > What is a good way to validate the query string provided by the user. > > On the other hand, if I want the user to build this query using some Solr api > instead of preparing a lucene query string which API can I use for this? > I looked into > SolrQuery in SolrJ but it does not appear to have a way to specify the more > complex queries with the boolean operators and operators such as ~,+,- etc. > > Basically, I am trying to avoid running into bad query strings built by the > caller. > > Thanks! > Dipti > > ________________________________ > This message is private and confidential. If you have received it in error, > please notify the sender and remove it from your system. >