Adding Indexers to Codebeamer
Codebeamer indexes for search Excel, MS-Word, Power-Point, RTF, PDF, Html, xml, Wiki and Plain text documents and attachments.
Following steps must be executed to add additional Indexers:
A java class must implement the interface com.intland.codebeamer.search.handler.DocumentHandler and the Indexer must be added to the "search" and "indexer" application configuration to get it known for Codebeamer.
The example below shows the plain-text Indexer assigned to the mime-type text/plain:




public class PlainTextHandler implements DocumentHandler {

private String encoding = null;



public Document getDocument(InputStream is) throws DocumentHandlerException {

try {

String body = Common.readFileToString(is, getEncoding());

if (body != null && body.length() != 0) {

Document doc = new Document();

doc.add(new Field(Fields.BODY, body, Field.Store.NO, Field.Index.TOKENIZED));

return doc;

}

return null;

} catch (IOException e) {

throw new DocumentHandlerException(e);

}

}



public String getEncoding() {

return encoding;

}



public void setEncoding(String enc) {

encoding = StringUtils.trimToNull(enc);

}

}
The appropriate entry in Application Configuration:
{
"mime-mapping": {
"class": "com.intland.codebeamer.search.handler.types.text.PlainTextHandler",
"mime-type": "text/plain"
}
}
The indexer class must be in CLASSPATH of Codebeamer and after modifying the required Application Configuration,Codebeamer must be re-started.
Was this helpful?