You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Neha Gupta <ne...@uni-jena.de> on 2022/04/15 20:24:40 UTC

Regarding query parameters in SOLRJ

Dear Solr Community,

This is regarding SOLRJ.

I want to query SOLR from java application using SOLRJ and i want to 
send multiple (in the range of 1-13) fields in the query parameter.
The only method i know is to create a string with these multiple fields 
and pass it as a string in method query.setQuery("multiple fields 
concatenated via AND OR")

Is there any better way of doing this as creating a string with all 
these multiple fields(1-13) can be cumbersome.


Thanks and Regards

Neha Gupta


Re: Regarding query parameters in SOLRJ

Posted by jagdish vasani <ja...@gmail.com>.
Sorry i did not got understood your question in previous mail.
But now i got it.

Query building is not part of solr, solrJ accepts query as input.
It depends on how user want to search.

You need build such query at UI level and pass whole AND , OR  and with
field query to q param or as setQuery method.

Hope this helps.

On Fri, Apr 15, 2022, 11:36 PM Neha Gupta <ne...@uni-jena.de> wrote:

> Hi SOLR community and Jagdish,
>
> Could you please tell me like how to build query using SOLRJ in case of
> below scenario: -
>
> Country: Germany *OR* UK *OR *Australia
>
> *AND*
>
> animal_gut:Yes
>
> *AND *
>
> dna_extraction_method: abd *OR *xyz
>
> *AND*
>
> host_class:Aves *OR *Mammalia
>
>
> I tried several ways but till no success.
>
> PS: - I don't want to make a query string with AND OR as i have around 13
> fields with each field having many options.
>
>
> Regards
>
> Neha Gupta
> On 16/04/2022 03:32, jagdish vasani wrote:
>
> You can check SolrQuery setParam method, as
> query.seParam("fl","id");
>
> On Fri, Apr 15, 2022, 4:25 PM Neha Gupta <ne...@uni-jena.de> <ne...@uni-jena.de> wrote:
>
>
> Dear Solr Community,
>
> This is regarding SOLRJ.
>
> I want to query SOLR from java application using SOLRJ and i want to
> send multiple (in the range of 1-13) fields in the query parameter.
> The only method i know is to create a string with these multiple fields
> and pass it as a string in method query.setQuery("multiple fields
> concatenated via AND OR")
>
> Is there any better way of doing this as creating a string with all
> these multiple fields(1-13) can be cumbersome.
>
>
> Thanks and Regards
>
> Neha Gupta
>
>
>
>

Re: Regarding query parameters in SOLRJ

Posted by Neha Gupta <ne...@uni-jena.de>.
Hi SOLR community and Jagdish,

Could you please tell me like how to build query using SOLRJ in case of 
below scenario: -

Country: Germany *OR* UK *OR *Australia

*AND*

animal_gut:Yes

*AND *

dna_extraction_method: abd *OR *xyz

*AND*

host_class:Aves *OR *Mammalia


I tried several ways but till no success.

PS: - I don't want to make a query string with AND OR as i have around 
13 fields with each field having many options.


Regards

Neha Gupta

On 16/04/2022 03:32, jagdish vasani wrote:
> You can check SolrQuery setParam method, as
> query.seParam("fl","id");
>
> On Fri, Apr 15, 2022, 4:25 PM Neha Gupta<ne...@uni-jena.de>  wrote:
>
>> Dear Solr Community,
>>
>> This is regarding SOLRJ.
>>
>> I want to query SOLR from java application using SOLRJ and i want to
>> send multiple (in the range of 1-13) fields in the query parameter.
>> The only method i know is to create a string with these multiple fields
>> and pass it as a string in method query.setQuery("multiple fields
>> concatenated via AND OR")
>>
>> Is there any better way of doing this as creating a string with all
>> these multiple fields(1-13) can be cumbersome.
>>
>>
>> Thanks and Regards
>>
>> Neha Gupta
>>
>>

Re: Regarding query parameters in SOLRJ

Posted by jagdish vasani <ja...@gmail.com>.
You can check SolrQuery setParam method, as
query.seParam("fl","id");

On Fri, Apr 15, 2022, 4:25 PM Neha Gupta <ne...@uni-jena.de> wrote:

> Dear Solr Community,
>
> This is regarding SOLRJ.
>
> I want to query SOLR from java application using SOLRJ and i want to
> send multiple (in the range of 1-13) fields in the query parameter.
> The only method i know is to create a string with these multiple fields
> and pass it as a string in method query.setQuery("multiple fields
> concatenated via AND OR")
>
> Is there any better way of doing this as creating a string with all
> these multiple fields(1-13) can be cumbersome.
>
>
> Thanks and Regards
>
> Neha Gupta
>
>