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 "kobe.free.world@gmail.com" <ko...@gmail.com> on 2013/03/18 10:03:07 UTC

SOLR - Define fields in DIH configuration file dynamically

Hello All,

Is there a way to manage (add/ remove) fields in the data import handler
configuration file dynamically through any API/ Library like SolrNet?

Thanks



--
View this message in context: http://lucene.472066.n3.nabble.com/SOLR-Define-fields-in-DIH-configuration-file-dynamically-tp4048465.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: SOLR - Define fields in DIH configuration file dynamically

Posted by Gora Mohanty <go...@mimirtech.com>.
On 19 March 2013 11:59, kobe.free.world@gmail.com
<ko...@gmail.com> wrote:
> Thanks for your reply.
>
> Please let me know, if it is also possible to define the complete set/list
> of the fields dynamically in the DIH config file. In our scenario, we will
> be required to change the set/list of the fields based on business needs
> regularly.
[...]

You can use dynamic fields as described here:
http://wiki.apache.org/solr/SchemaXml#Dynamic_fields
Many examples are available by searching Google for
"solr schema dynamic fields".

Regards,
Gora

RE: SOLR - Define fields in DIH configuration file dynamically

Posted by "kobe.free.world@gmail.com" <ko...@gmail.com>.
Thanks for your reply.

Please let me know, if it is also possible to define the complete set/list
of the fields dynamically in the DIH config file. In our scenario, we will
be required to change the set/list of the fields based on business needs
regularly.



--
View this message in context: http://lucene.472066.n3.nabble.com/SOLR-Define-fields-in-DIH-configuration-file-dynamically-tp4048465p4048884.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: SOLR - Define fields in DIH configuration file dynamically

Posted by "Dyer, James" <Ja...@ingramcontent.com>.
There are 3 approaches I can think of:

1. You can generate a new data-config.xml for each import.  With Solr 4.0 and later, DIH re-parses your data-config.xml and picks up any changes automatically.

2. You can parameterize nearly anything in data-config.xml, add the parameters to your request URL like:
/solr/dataimport?command=full-import&key=value
...then use ${dataimporter.request.key} in your data-config.xml

3. You can put optional sections into sql queries, then use parameters to insert comment strings:
/solr/dataimport?command=full-import&openComment=/*&closeComment=*/
<entity query="
 select id, something${dataimporter.request.openComment},optionalStuff${dataimporter.request.closeComment} from foo
"/>

Not sure if this is the answer to your question.  If not, give more details.

James Dyer
Ingram Content Group
(615) 213-4311

-----Original Message-----
From: kobe.free.world@gmail.com [mailto:kobe.free.world@gmail.com] 
Sent: Monday, March 18, 2013 4:03 AM
To: solr-user@lucene.apache.org
Subject: SOLR - Define fields in DIH configuration file dynamically

Hello All,

Is there a way to manage (add/ remove) fields in the data import handler
configuration file dynamically through any API/ Library like SolrNet?

Thanks



--
View this message in context: http://lucene.472066.n3.nabble.com/SOLR-Define-fields-in-DIH-configuration-file-dynamically-tp4048465.html
Sent from the Solr - User mailing list archive at Nabble.com.