public class SearchReport extends Object
Learn more
The example demonstrates a typical usage of the class.
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);
// Searching in index
SearchResult result1 = index.search("Einstein");
SearchResult result2 = index.search("\"Theory of Relativity\"");
// Getting search reports
SearchReport[] reports = index.getSearchReports();
// Printing reports to the console
for (SearchReport report : reports) {
System.out.println("Query: " + report.getTextQuery());
DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
System.out.println("Time: " + df.format(report.getStartTime()));
System.out.println("Duration: " + report.getSearchDuration());
System.out.println("Documents: " + report.getDocumentCount());
System.out.println("Occurrences: " + report.getOccurrenceCount());
System.out.println();
}
Modifier | Constructor and Description |
---|---|
protected |
SearchReport(com.aspose.ms.System.DateTime startTime,
com.aspose.ms.System.DateTime endTime,
SearchQuery objectQuery,
SearchOptions searchOptions,
SearchResult searchResult) |
protected |
SearchReport(com.aspose.ms.System.DateTime startTime,
com.aspose.ms.System.DateTime endTime,
String textQuery,
SearchOptions searchOptions,
SearchResult searchResult) |
Modifier and Type | Method and Description |
---|---|
protected static SearchReport |
create(com.aspose.ms.System.DateTime startTime,
com.aspose.ms.System.DateTime endTime,
SearchQuery objectQuery,
SearchOptions searchOptions,
SearchResult searchResult) |
protected static SearchReport |
create(com.aspose.ms.System.DateTime startTime,
com.aspose.ms.System.DateTime endTime,
String textQuery,
SearchOptions searchOptions,
SearchResult searchResult) |
int |
getDocumentCount()
Gets the number of documents found.
|
Date |
getEndTime()
Gets the end time of the search.
|
SearchQuery |
getObjectQuery()
Gets the search query in object form.
|
int |
getOccurrenceCount()
Gets the total number of occurrences found.
|
double |
getSearchDuration()
Gets the search duration in seconds.
|
SearchOptions |
getSearchOptions()
Gets the search options.
|
Date |
getStartTime()
Gets the start time of the search.
|
String |
getTextQuery()
Gets the search query in text form.
|
String |
toString()
Returns a String that represents the current
SearchReport . |
protected SearchReport(com.aspose.ms.System.DateTime startTime, com.aspose.ms.System.DateTime endTime, String textQuery, SearchOptions searchOptions, SearchResult searchResult)
protected SearchReport(com.aspose.ms.System.DateTime startTime, com.aspose.ms.System.DateTime endTime, SearchQuery objectQuery, SearchOptions searchOptions, SearchResult searchResult)
public final Date getStartTime()
Gets the start time of the search.
public final Date getEndTime()
Gets the end time of the search.
public final double getSearchDuration()
Gets the search duration in seconds.
public final int getDocumentCount()
Gets the number of documents found.
public final int getOccurrenceCount()
Gets the total number of occurrences found.
public final String getTextQuery()
Gets the search query in text form.
public final SearchQuery getObjectQuery()
Gets the search query in object form.
public final SearchOptions getSearchOptions()
Gets the search options.
public String toString()
Returns a String that represents the current SearchReport
.
protected static SearchReport create(com.aspose.ms.System.DateTime startTime, com.aspose.ms.System.DateTime endTime, String textQuery, SearchOptions searchOptions, SearchResult searchResult)
protected static SearchReport create(com.aspose.ms.System.DateTime startTime, com.aspose.ms.System.DateTime endTime, SearchQuery objectQuery, SearchOptions searchOptions, SearchResult searchResult)