This exact topic was just discussed a few days ago... http://search.lucidimagination.com/search/document/7b6e2cc37bbb95c8/faceting_and_first_letter_of_fields#3059a28929451cb4
My comments on when/where it makes sense to put this logic... http://search.lucidimagination.com/search/document/7b6e2cc37bbb95c8/faceting_and_first_letter_of_fields#7b6e2cc37bbb95c8 : Date: Mon, 18 Oct 2010 19:31:28 -0200 : From: Renato Wesenauer <renato.wesena...@gmail.com> : Reply-To: solr-user@lucene.apache.org : To: solr-user@lucene.apache.org : Subject: I need to indexing the first character of a field in another field : : Hello guys, : : I need to indexing the first character of the field "autor" in another field : "inicialautor". : Example: : autor = Mark Webber : inicialautor = M : : I did a javascript function in the dataimport, but the field inicialautor : indexing empty. : : The function: : : function InicialAutor(linha) { : var aut = linha.get("autor"); : if (aut != null) { : if (aut.length > 0) { : var ch = aut.charAt(0); : linha.put("inicialautor", ch); : } : else { : linha.put("inicialautor", ''); : } : } : else { : linha.put("inicialautor", ''); : } : return linha; : } : : What's wrong? : : Thank's, : : Renato Wesenauer : -Hoss