> > I don't think request handler should be a problem. I
> have just used the *q
> *parameter as follows.
> 
> String q = params.get(CommonParams.Q);
> IndexSchema schema = req.getSchema();
> Query query = new QueryParsing().parseQuery(q, schema);
> 
> Hope there shouldn't be a problem with the above!

Solr converts top level negative query (-field:something) into q=+*:* 
-field:something

It seems that you are missing that part.

org.apache.solr.search.QueryUtils

/** Fixes a negative query by adding a MatchAllDocs query clause.
   * The query passed in *must* be a negative query.
   */
  public static Query fixNegativeQuery(Query q) {
    BooleanQuery newBq = (BooleanQuery)q.clone();
    newBq.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST);
    return newBq;    
  }

Reply via email to