What version of Solr are you using? I don't see any SolrQuery.set().
But with 4.x I think you want solrQuery.addValueToParam();

On Wed, Jun 19, 2013 at 8:06 AM, ade-b <adrian.bro...@gmail.com> wrote:
> Hi
>
> We have a request handler defined in solrconfig.xml that specifies a list of
> fields to return for the request using the "fl" name.
>
> E.g. <str name="fl">createdDate</str>
>
> When constructing a query using solrj that uses this request handler, we
> want to conditionally add the geo spatial fields that will tell us the
> distance of a record in the solr index from a given location. Currently we
> add this to the query by specifying
>
> solrQuery.set("fl", "*,distance:geodist()");
>
> This has the effect of returning all fields for the record - not those
> specified in the request handler. I'm assuming this is because of the * in
> the solrQuery.set method is overriding those statically defined in the
> request handler.
>
> I have tried to add the geodist property via the solrQuery.addField()
> method, but that complains saying it is not a valid field - maybe I used it
> incorrectly?
>
> Has anybody any ideas how to achieve this?
>
> Thanks
> Ade
>
>
>
>
>
>
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/How-to-dynamically-add-geo-fields-to-a-query-using-a-request-handler-tp4071655.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to