[ 
https://issues.apache.org/jira/browse/SOLR-4386?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Dyer updated SOLR-4386:
-----------------------------

    Attachment: SOLR-4386.patch

Here is a failing test for this.  The problem is PropertiesWriter gets a 
DataImporter in its "init" method, which does not give it access to the 
Context/VariableResolver.  Either this api should change (no problem, it is 
"experimental") or we should expose the context at the DataImporter.  In 
reality, we should reorganize DataImporter/DocBuilder/Context so that there is 
just 1 class every component needs to go to to get answers, etc..
                
> Variable expansion doesn't work in DIH SimplePropertiesWriter's filename
> ------------------------------------------------------------------------
>
>                 Key: SOLR-4386
>                 URL: https://issues.apache.org/jira/browse/SOLR-4386
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - DataImportHandler
>    Affects Versions: 4.1
>            Reporter: Jonas Birgander
>              Labels: dataimport
>         Attachments: SOLR-4386.patch
>
>
> I'm testing Solr 4.1, but I've run into some problems with 
> DataImportHandler's new propertyWriter tag.
> I'm trying to use variable expansion in the `filename` field when using 
> SimplePropertiesWriter.
> Here are the relevant parts of my configuration:
> conf/solrconfig.xml
> -----------------------------------------------------------------------------
> <requestHandler name="/dataimport" 
> class="org.apache.solr.handler.dataimport.DataImportHandler">
>   <lst name="defaults">
>     <str name="config">db-data-config.xml</str>
>   </lst>
>   <lst name="invariants">
>     <!-- country_code is available -->
>     <str name="country_code">${country_code}</str>
>     <!-- In the real config, more variables are set here -->
>   </lst>
> </requestHandler>
> conf/db-data-config.xml
> -----------------------------------------------------------------------------
> <dataConfig>
>   <propertyWriter
>     dateFormat="yyyy-MM-dd HH:mm:ss"
>     type="SimplePropertiesWriter"
>     directory="conf"
>     filename="${dataimporter.request.country_code}.dataimport.properties"
>     />
>   <dataSource type="JdbcDataSource"
>     driver="${dataimporter.request.db_driver}"
>     url="${dataimporter.request.db_url}"
>     user="${dataimporter.request.db_user}"
>     password="${dataimporter.request.db_password}"
>     batchSize="${dataimporter.request.db_batch_size}" />
>   <document>
>     <entity name="item"
>       query="my normal SQL, not really relevant
>             -- country=${dataimporter.request.country_code}">
>       <field column="id"/>
>         <!-- ...more field tags... -->
>         <field column="$deleteDocById"/>
>       <field column="$skipDoc"/>
>     </entity>
>   </document>
> </dataConfig>
> If country_code is set to "gb", I want the last_index_time to be read and 
> written in the file conf/gb.dataimport.properties, instead of the default 
> conf/dataimport.properties
> The variable expansion works perfectly in the SQL and setup of the data 
> source, but not in the property writer's filename field.
> When initiating an import, the log file shows:
> Jan 30, 2013 11:25:42 AM org.apache.solr.handler.dataimport.DataImporter 
> maybeReloadConfiguration
> INFO: Loading DIH Configuration: db-data-config.xml
> Jan 30, 2013 11:25:42 AM 
> org.apache.solr.handler.dataimport.config.ConfigParseUtil verifyWithSchema
> INFO: The field :$skipDoc present in DataConfig does not have a counterpart 
> in Solr Schema
> Jan 30, 2013 11:25:42 AM 
> org.apache.solr.handler.dataimport.config.ConfigParseUtil verifyWithSchema
> INFO: The field :$deleteDocById present in DataConfig does not have a 
> counterpart in Solr Schema
> Jan 30, 2013 11:25:42 AM org.apache.solr.handler.dataimport.DataImporter 
> loadDataConfig
> INFO: Data Configuration loaded successfully
> Jan 30, 2013 11:25:42 AM org.apache.solr.handler.dataimport.DataImporter 
> doFullImport
> INFO: Starting Full Import
> Jan 30, 2013 11:25:42 AM 
> org.apache.solr.handler.dataimport.SimplePropertiesWriter 
> readIndexerProperties
> WARNING: Unable to read: 
> ${dataimporter.request.country_code}.dataimport.properties

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to