On 4/11/2018 9:21 AM, rameshkjes wrote:
> I am doing configuration of solr with the xml and pdf dataset, it works
> perfect. But, I want to modify few things: 
> Such as, we can see below, "baseDir" and "filePrefix" is being defined
> manually. I want this to be defined on the runtime.

The way I would do this is to have DIH grab that information from URL
parameters on the request to start the import.

So your URL would look like this:

?command=full-import&baseDir=somePath&filePathPrefix=someOtherPath

And your config would look like this:

<entity name="file" processor="FileListEntityProcessor"
  baseDir="${dih.request.baseDir}"
  fileName=".*xml" rootEntity="false" datasource="null"
  transformer="pathos.utils.transformer.FilePathTransformer">
  <field column="filePath"
    filePrefix="/${dih.request.filePathPrefix/}"

I *think* that the property substitution has to happen inside the quotes
like I have shown, but I'm not completely positive.  I'm using that
functionality for parts of an SQL query, which is definitely inside the
quotes.

Be aware that you will need to run the values in the URL parameters
through an encoder function to make sure they're properly encoded.  For
instance, the value you're using for "filePrefix" would actually look
like this on the URL:

C%3a%2fUsers%2fkuma_rm%2fgithub%2fML%2fdataset%2fPdfMetaData%2f

Thanks,
Shawn

Reply via email to