private void indexDocument ( HelpModule helpModule , Resource resource ) throws Exception { String title = getTitle ( resource ) ; try ( InputStream is = resource . getInputStream ( ) ) { Document document = new Document ( ) ; document . add ( new TextField ( "module" , helpModule . getLocalizedId ( ) , Store . YES ) ) ; document . add ( new TextField ( "source" , helpModule . getTitle ( ) , Store . YES ) ) ; document . add ( new TextField ( "title" , title , Store . YES ) ) ; document . add ( new TextField ( "url" , resource . getURL ( ) . toString ( ) , Store . YES ) ) ; document . add ( new TextField ( "content" , tika . parseToString ( is ) , Store . NO ) ) ; writer . addDocument ( document ) ; } }
Index an HTML text file resource .