// results: SearchResults from a previous search // whichDoc: integer from 0 to results.getCount()-1 identifying the document to display // Select the item to display results.getNthDoc(whichDoc); String f = results.getDocName(); com.dtsearch.engine.FileConverter fc = new com.dtsearch.engine.FileConverter(); // Set up FileConverter to use the selected item from search results fc.setInputItem(results, index); // If the file is HTML, this ensures that it has a BASE tag preserving relative links fc.setBaseHref(f); // Generate HTML output in a string fc.setOutputToString(true); fc.setOutputFormat(Constants.it_HTML); // Highlight hits by making them bold fc.setBeforeHit("<b>"); fc.setAfterHit("</b>"); // Perform the conversion fc.execute(); // Display the result setHtml(fc.getOutputString());
|
Copyright (c) 1998-2008 dtSearch Corp. All rights reserved.
|