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

Creating dynamically named fields in requires a Transformer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 4.1
    • None
    • None
    • Ubuntu 12.04 LTS, fresh download of SOLR.

    Description

      I needed to index multiple fields from a table dynamically. At first it didn't work, reading the field name as "_t". Out of curiosity, I added a transformer declaration to the entity. This gave me the list of fields I needed.

      Why did adding a transformer that is never used fix my problem? Removing the transformer declaration causes the problem to come back, and it does not matter which transformer I declare.

      I am running Solr 4.1, and this issue first happened to me on the included example-DIH example that came with the download. I read the Solr reference guide for 4.0, and could not find a reason why adding a transformer made it work.

      Below is the db-data-config.xml file:

       
          <dataConfig>
      	<dataSource name="foo" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/foo"  user="fakeadmin" password="fakepass"/>
      	<document>
      		<entity name="products" query="select * from `product`">
      			<field name="id" column="id" />
      			<entity name="names" query="select * from names where productId = '${products.id}'" transformer="LogTransformer">
      				<field name="${names.fieldName}_t" column="fieldValue"/>
      			</entity>
      		</entity>
      	</document>
      </dataConfig>
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              turkeyfried Luis Pabon
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: