简体   繁体   中英

Solr custom Transformer

I'm quite new to solr and till now i only use it to index data from DB. Now I'm trying to write a custom Transformer. I've read the documentation at http://wiki.apache.org/solr/DIHCustomTransformer , but i can't figure out how to configure it to be visible from the DIH.

My purpose is to index uploaded images data. Some information comes from a db, for example the owner of the image or the path where the file is stored. Other information, mostly metadata, are extracted from the image file. My idea is to set a dataInputHandler that extracts data from db, and a Transformer that extracts metadata and puts it in the solr document.

Can someone explain me how custom transformers works?

Thanks in advance for the help

The class will have to be available on the class path visible to Solr, usually through a .jar file available in one of the configured lib directories (or you can add your own to your solr configuration file (solrconfig.xml - any paths will be relative to this file in a <lib> entry). See How to Load Plugins for more information about how Solr finds your plugin code.

Your transformer will then receive the whole row from the DB, where you can read the file path and add new columns to the row returned to the DIH importer to be included in your document.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM