Hi, My team had a request to host a web service that validates a query to our solr instance without actually submitting the query. I'm having some trouble getting it to work.
At the moment I have successfully loaded in a SolrConfig and IndexSchema, which were built with the same config and schema files as my team's real Solr instance. The objective here is to get a QueryParser that has the exact same behaviour as Solr's, so we can parse query strings and tell our users if the query is valid, or why it's not valid. So I was getting a QueryParser like this: queryParser=new QueryParser(Version.LUCENE_43,"text",schema.getQueryAnalyzer()); Everything appeared to be fine until I tested it with this "REALFIELD:*", where REALFIELD was actually the name of some real field in our solr schema. It threw an exception claiming that "'*' or '?' not allowed as first character in WildcardQuery". That is actually false, our users can and do submit queries that start with wildcards. So I know I must have the wrong type of object for a QueryParser, I think I'm supposed to be using an instance of SolrQueryParser instead of lucene's QueryParser, but I cannot figure out how to instantiate a SolrQueryParser. The constructor for a SolrQueryParser requires a QParser instance. There are three types of QParsers, DisMaxQParser<http://lucene.apache.org/solr/4_0_0/solr-core/org/apache/solr/search/DisMaxQParser.html> , FunctionQParser<http://lucene.apache.org/solr/4_0_0/solr-core/org/apache/solr/search/FunctionQParser.html> , SpatialFilterQParser<http://lucene.apache.org/solr/4_0_0/solr-core/org/apache/solr/search/SpatialFilterQParser.html>, I don't think our solr cluster uses any of those. Would somebody please explain to me how to properly get an instance of a SolrQueryParser when all I have is the SolrConfig and IndexSchema? Michael Knapp