Hi Gora,

Unfortunately reorganizing the data is not an option for me.
Multiple databases exist and a third party is taking care of
populating them. Once a database reaches a certain size, a switch
occurs and a new database is created with the same table structure.


Gora Mohanty-3 wrote:
> 
> I meant a script that runs the query that defines the datasources for all
> fields, writes a Solr DIH configuration file, and then initiates a
> dataimport.
> 
Ok, so the query would select only the articles for which the data is 
sitting in a specific datasource. Then, only that one datasource would be
indexed.
For each additional datasource would the script initiate another full-import
with 
the clean attribute set to false?


I tried to make some changes to DIH that comes with Solr 1.4.1
The getResolvedEntityAttribute("dataSource"); method seems to so the trick.
Here is the modified code. It feels awkward but it seems to work.

org.apache.solr.handler.dataimport.ContextImpl

  public DataSource getDataSource() {
    if (ds != null) return ds;
    if(entity == null) return  null;
    
    String dataSourceResolved =
this.getResolvedEntityAttribute("dataSource");
 
    if (entity.dataSrc == null) {      
        entity.dataSrc = dataImporter.getDataSourceInstance(entity,
dataSourceResolved, this);
        entity.dataSource = dataSourceResolved;
    } else if (!dataSourceResolved.equals(entity.dataSource)) { 
        entity.dataSrc.close();
        entity.dataSrc = dataImporter.getDataSourceInstance(entity,
dataSourceResolved, this);
        entity.dataSource = dataSourceResolved;
    }
    if (entity.dataSrc != null && docBuilder != null &&
docBuilder.verboseDebug &&
             Context.FULL_DUMP.equals(currentProcess())) {
      //debug is not yet implemented properly for deltas
      entity.dataSrc =
docBuilder.writer.getDebugLogger().wrapDs(entity.dataSrc);
    }
    return entity.dataSrc;
  }

I hope I am not breaking any other functionality... 
Would it be possible to add something like this to a future release?

Regards,
Alex



-- 
View this message in context: 
http://lucene.472066.n3.nabble.com/Resolve-a-DataImportHandler-datasource-based-on-previous-entity-tp2235573p2241653.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to