GetDocumentText

GetDocumentText(DocumentInfo, OutputAdapter)

Generates the text of an indexed document and passes it through an output adapter.

public void GetDocumentText(DocumentInfo documentInfo, OutputAdapter adapter)
Parameter Type Description
documentInfo DocumentInfo The indexed document info.
adapter OutputAdapter The output adapter.

Exceptions

exception condition
ObjectDisposedException The index is disposed.

Remarks

The text is read from the index if the index stores the texts of the documents; otherwise the document is extracted again from the file at its path. A document that the index does not contain gives no text, and the ErrorOccurred event reports it.

Examples

The example demonstrates how to get the text of an indexed document from an index.

string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";
 
// Creating an index in the specified folder
Index index = new Index(indexFolder);
 
// Indexing documents from the specified folder
index.Add(documentsFolder);
 
// Getting list of indexed documents
DocumentInfo[] documents = index.GetIndexedDocuments();
 
// Getting a document text
if (documents.Length > 0)
{
    FileOutputAdapter outputAdapter = new FileOutputAdapter(OutputFormat.Html, @"C:\Text.html");
    index.GetDocumentText(documents[0], outputAdapter);
}

See Also


GetDocumentText(DocumentInfo, OutputAdapter, TextOptions)

Generates the text of an indexed document with the specified options and passes it through an output adapter.

public void GetDocumentText(DocumentInfo documentInfo, OutputAdapter adapter, TextOptions options)
Parameter Type Description
documentInfo DocumentInfo The indexed document info.
adapter OutputAdapter The output adapter.
options TextOptions The text retrieving options.

Exceptions

exception condition
ObjectDisposedException The index is disposed.

Remarks

The text is read from the index if the index stores the texts of the documents; otherwise the document is extracted again from the file at its path. A document that the index does not contain gives no text, and the ErrorOccurred event reports it.

See Also