You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by solr2020 <ps...@gmail.com> on 2017/09/21 15:17:03 UTC

overwrite the parameter query in DIH

Hi All,

We are retrieving mongodb data using Dataimport handler. We have a scenario
where we have to overwrite the mongodb query configured in data-config file.
We have to do this overwrite programmatically using solrj. For this we are
using ModifiableSolrParams to set the parameters. Here is the code snippet
used to create a dataimport http request.

                String solrURL=
"http://<server>:<port>/solr/collectionname";
	        SolrClient solr = new HttpSolrClient.Builder(solrURL).build();
		ModifiableSolrParams params = new ModifiableSolrParams();
		params.set("qt", "/dataimport");
		params.set("command", "full-import");
		params.set("query=id:{ $in: ", idlist+ " }");
		QueryResponse response = solr.query(params);

Here the expectation is it should use this query parameter value given in
the code snippet instead of using the query parameter configured in
data-config file.

Is there a way to do this? .Please suggest.




--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: overwrite the parameter query in DIH

Posted by solr2020 <ps...@gmail.com>.
Thanks Erick.

We are almost done with the full indexing part using DIH.  So if we change
the approach using Solrj now, we need to re-write the entire thing. So is
there any way to overwrite the DIH data config file.



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: overwrite the parameter query in DIH

Posted by Erick Erickson <er...@gmail.com>.
Quite frankly if you can't just configure this in DIH I'd do all the
indexing from SolrJ.

Long blog on the subject here:
https://lucidworks.com/2012/02/14/indexing-with-solrj/

Best,
Erick

On Thu, Sep 21, 2017 at 8:17 AM, solr2020 <ps...@gmail.com> wrote:
> Hi All,
>
> We are retrieving mongodb data using Dataimport handler. We have a scenario
> where we have to overwrite the mongodb query configured in data-config file.
> We have to do this overwrite programmatically using solrj. For this we are
> using ModifiableSolrParams to set the parameters. Here is the code snippet
> used to create a dataimport http request.
>
>                 String solrURL=
> "http://<server>:<port>/solr/collectionname";
>                 SolrClient solr = new HttpSolrClient.Builder(solrURL).build();
>                 ModifiableSolrParams params = new ModifiableSolrParams();
>                 params.set("qt", "/dataimport");
>                 params.set("command", "full-import");
>                 params.set("query=id:{ $in: ", idlist+ " }");
>                 QueryResponse response = solr.query(params);
>
> Here the expectation is it should use this query parameter value given in
> the code snippet instead of using the query parameter configured in
> data-config file.
>
> Is there a way to do this? .Please suggest.
>
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: overwrite the parameter query in DIH

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello,

I don't fully understand the question but you might need to check this
https://lucene.apache.org/solr/guide/6_6/uploading-structured-data-store-data-with-the-data-import-handler.html#dih-request-parameters


On Thu, Sep 21, 2017 at 6:17 PM, solr2020 <ps...@gmail.com> wrote:

> Hi All,
>
> We are retrieving mongodb data using Dataimport handler. We have a scenario
> where we have to overwrite the mongodb query configured in data-config
> file.
> We have to do this overwrite programmatically using solrj. For this we are
> using ModifiableSolrParams to set the parameters. Here is the code snippet
> used to create a dataimport http request.
>
>                 String solrURL=
> "http://<server>:<port>/solr/collectionname";
>                 SolrClient solr = new HttpSolrClient.Builder(
> solrURL).build();
>                 ModifiableSolrParams params = new ModifiableSolrParams();
>                 params.set("qt", "/dataimport");
>                 params.set("command", "full-import");
>                 params.set("query=id:{ $in: ", idlist+ " }");
>                 QueryResponse response = solr.query(params);
>
> Here the expectation is it should use this query parameter value given in
> the code snippet instead of using the query parameter configured in
> data-config file.
>
> Is there a way to do this? .Please suggest.
>
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>



-- 
Sincerely yours
Mikhail Khludnev