

HTML, RTF, XML or plain text, and the strings to be inserted before and after each hit. After this the only things we need to set are the output format required, e.g. For example: FileConverter fc=new FileConverter() Ĭreates a FileConverter and initializes it so as to be ready to process the first document in the results. The SetInputItem method can be used to set all of the necessary properties from a SearchResults object. You can do this job one property at a time and it isn't difficult but if the file has been returned as the result of a search then it is even easier. If you want to process a general file then you need to specify the file name as Inputfile or it the data is in a memory buffer then use InputBytes. You also have to specify what format you want the results in and what strings you want to use to mark up the hits. The properties that you have to set are also fairly simple: the name of the file to process, a hits array giving the offsets from the start of the file of each of the hits, a specification of what characters constitute a word break, the index that the file was retrieved from and the document id. All you have to do is set its properties correctly and call its Execute method and the job is done. The first thing to say is that FileConverter is general and will process a document even if you acquired it by some complicated route. Just this feat alone is worth its weight in code but it will also "decorate" the conversion with markers that can be used to highlight the hits. and performs a transformation on it to HTML, RTF, XML or plain text.

This takes a file in any of the supported formats, and there are a lot of supported formats. The central object in making hit highlighting and other similar tasks very easy indeed is the FileConverter.
