Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-2094

When using a XPathEntityProcessor nested within another entity, the xpathReader isn't reinitilized for each new document

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4.1
    • 6.3
    • None
    • Solr 1.4

    Description

      I have a dih config with a SqlEntityProcessor that retrives a table. I then have a sub-entity with the XPathEntityProcessor type, this takes a value from the table as input to parse through an xml doc.
      I find that the first document is created correctly, but then the xpathReader of the XPathEntityProcessor does not reinitialize for the following documents so the initial documents input is used.

      <dataSource name="hivseqdb" driver="com.mysql.jdbc.Driver"
      	   url="l"
                 user="hivseqdb" password="hivseqdb" batchSize="1"/>
                 
          <dataSource name="xmlFile" type="FileDataSource" />
          
      	<document><entity name="Sequence" dataSource="hivseqdb" pk="se_id" query="SELECT * FROM hivseqdb.sequenceentry where se_id != '1'">
      			
                  <entity name="FMA_Tissue_Hierarchy" 
                  		dataSource="xmlFile"
                  		pk="fma-id"
                  		forEach="/tissue-samples" 
                  		processor="XPathEntityProcessor" 
                  		url="/opt/hivseqdb/solr/conf/sub_ontology_translated.xml" 
                  		stream="true">
                      <field column="tissue-antology-parent-path" xpath="/tissue-samples/tissue[@fma-id='${Sequence.sampleTissueCode}']/parent-path"/>
                  </entity>
      

      DocBuilder dose call init on the XPathEntityProcessor but there is a conditional in the init method to check if the xpathReader is null:

        public void init(Context context) {
          super.init(context);
          if (xpathReader == null)
            initXpathReader();
          pk = context.getEntityAttribute("pk");
          dataSource = context.getDataSource();
          rowIterator = null;
      
        }
      

      So the xPathReader is used again and again. Is there away to reinitialize the xPathReader for every document? Or what is the specific design reason for preserving it?

      Attachments

        1. SOLR-2094.patch
          14 kB
          Cao Manh Dat
        2. SOLR-2094.patch
          11 kB
          Cao Manh Dat
        3. SOLR-2094.patch
          11 kB
          Noble Paul
        4. SOLR-2094.patch
          12 kB
          Noble Paul

        Activity

          People

            noble.paul Noble Paul
            nialloc Niall O'Connor
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: