On Fri, May 18, 2012 at 7:26 PM, Ahmet Arslan <iori...@yahoo.com> wrote:
> > > 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; > } > Oh thats great :) Thank you very much! You made my day :) -- With Thanks and Regards, Ramprakash Ramamoorthy, Project Trainee, Zoho Corporation. +91 9626975420