On Tue, 24 Aug 2010 08:46:52 +0200 Gonzalo Payo Navarro <gpa...@gmail.com> wrote:
> Hi everyone! > > I need to get the first 100 chars of a string-type field, but I > am not able to find something like a SubstringTransformer, > therefore I am using the RegexTransformer, but I suspect that it > eats a lot of time on indexation time. > > So, in short, I need something like a SubstringTransformer: Is > there something like that? [...] Not sure of the efficiency vis-a-vis RegexTransformer, but take a look at ScriptTransformer: http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer Something along the lines of: <dataConfig> <script><![CDATA[ function first100(row) { var in = row.get( "myfield" ); row.put( "myfield", in.substr( 0, 100 ) ); return row; } ]]></script> <document> <entity name="e" pk="id" transformer="script:first100" query="select * from X"> .... </entity> </document> </dataConfig> should do the job. Regards, Gora