Hi,
Both are good questions — let me take them separately.
1. What happened to the other five documents
The key thing is that search never touches your files. It only queries what is already in the index. So the five documents that came back empty fall into three different buckets, and you can tell them apart:
- they were indexed fine and simply do not contain “Oxygen”;
- they were indexed, but text extraction failed or only partly succeeded (corrupt file, password-protected, an embedded part that could not be read);
- they never entered the index at all (unsupported format, filtered out, skipped).
To separate those, start from the list of what actually made it in:
DocumentInfo[] documents = index.getIndexedDocuments();
for (DocumentInfo document : documents) {
System.out.println(document.getFilePath() + " indexedWithError=" + document.getIndexedWithError());
}
Any of your ten files missing from that array never got indexed. Any file present with getIndexedWithError() returning true is one where extraction ran into trouble — that is your “the search did not complete” case. Whatever is left is a genuine “the word is not in this document”.
For the reason behind a failure, subscribe while indexing:
index.getEvents().ErrorOccurred.add(new EventHandler<IndexErrorEventArgs>() {
public void invoke(Object sender, IndexErrorEventArgs args) {
System.out.println(args.getMessage() + ", critical: " + args.isCritical());
}
});
index.getEvents().OperationProgressChanged.add(new EventHandler<OperationProgressEventArgs>() {
public void invoke(Object sender, OperationProgressEventArgs args) {
System.out.println(args.getLastDocumentPath() + " -> " + args.getLastDocumentStatus());
}
});
index.add(documentsFolder);
getLastDocumentStatus() returns SuccessfullyProcessed, Skipped or ProcessedWithError, per document. Worth adding PasswordRequired too, since protected files are a common cause of an empty result.
If you need this after the fact rather than live, the index keeps it:
for (IndexingReport report : index.getIndexingReports()) {
System.out.println(Arrays.toString(report.getErrors()));
System.out.println(Arrays.toString(report.getIndexedDocuments()));
}
And when you want to settle a specific document for certain, dump what was actually extracted from it and look with your own eyes (this needs text storage enabled on the index through IndexSettings.setTextStorageSettings):
index.getDocumentText(documents[0], new FileOutputAdapter("C:\\Text.html"));
That last one is the one I would reach for first. It answers “was the word there and missed, or was it never extracted” directly, with no guessing.
2. Chart pasted from Excel into Word
Most likely no, and it depends on how the chart landed in the document.
Searching works on the plain text extracted from the file. Axis titles, series names and data labels of a Word chart are not part of the document’s text flow — they live in the chart part with its own embedded workbook. Plain text extraction does not walk into that, so a search for a label will not match. If you pasted the chart as a picture instead, the labels are pixels, and nothing short of OCR will see them; GroupDocs.Search can do that, but only if you enable OCR indexing and plug in an OCR connector via OcrIndexingOptions.
Rather than take my word for it, run the same check as above on that one document: index it, call getDocumentText, and search the output for one of your labels. Thirty seconds, and it tells you exactly what the index has to work with.
If those labels do need to be findable, the practical routes are to keep the source workbook in the indexed folder as well, or to repeat the wording in the document body — a caption under the chart, for instance.
Hope this helps.