Hi Markus,

That's really great info. Thank you.

Supposing we've now modified the Query object, do you know how we would get
the corresponding query String, which we could then forward to our
Solrcloud via SolrClient?

(Or should we be using this extended ExtendedDisMaxQParser class server
side in Solr?)

Kind regards,

Edd

--------------------
Edward Turner


On Mon, 17 Aug 2020 at 15:06, Markus Jelsma <markus.jel...@openindex.io>
wrote:

> Hello Edward,
>
> Yes you can by extending ExtendedDismaxQParser [1] and override its
> parse() method. You get the main Query object through super.parse().
>
> If you need even more fine grained control on how Query objects are
> created you can extend ExtendedSolrQueryParser's [2] (inner class)
> newFieldQuery() method.
>
> Regards,
> Markus
>
> [1]
> https://lucene.apache.org/solr/8_6_0/solr-core/org/apache/solr/search/ExtendedDismaxQParser.html
> [2]
> https://lucene.apache.org/solr/8_6_0/solr-core/org/apache/solr/search/ExtendedDismaxQParser.ExtendedSolrQueryParser.html
>
> -----Original message-----
> > From:Edward Turner <eddtur...@gmail.com>
> > Sent: Monday 17th August 2020 15:53
> > To: solr-user@lucene.apache.org
> > Subject: Manipulating client's query using a Query object
> >
> > Hi all,
> >
> > Thanks for all your help recently. We're now using the edismax query
> parser
> > and are happy with its behaviour. We have another question which maybe
> > someone can help with.
> >
> > We have one use case where we optimise our query before sending it to
> Solr,
> > and we do this by manipulating the client's input query string. However,
> > we're slightly uncomfortable using String manipulation to do this as
> > there's always the possibility we parse their string wrongly. (We have a
> > large test suite to check if we're doing the right thing, but even then,
> we
> > String manipulation doesn't feel right ...).
> >
> > Question: is it possible to get a Lucene Query representation of the
> > client's query, which we can then navigate and manipulate -- before we
> then
> > send the String representation of this Query to Solr for evaluation?
> >
> > Kind regards and thank you for your help in advance,
> >
> > Edd
> >
>

Reply via email to