Re: How to dynamically add geo fields to a query using a request handler

2013-07-26 Thread ade-b
I just realised that you can use the "appends" attribute value in the request
handler config (of solrconfig.xml). By setting this, any additional fields
you add via the solrj API are appended.

Thanks



--
View this message in context: 
http://lucene.472066.n3.nabble.com/How-to-dynamically-add-geo-fields-to-a-query-using-a-request-handler-tp4071655p4080619.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: How to dynamically add geo fields to a query using a request handler

2013-06-21 Thread Erick Erickson
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  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. createdDate
>
> 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.


How to dynamically add geo fields to a query using a request handler

2013-06-19 Thread ade-b
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. createdDate

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.