SearchReport
Leave feedback
On this page
Inheritance: java.lang.Object
public abstract class SearchReport
Represents a detailed information on a search operation.
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();
}
```
| Constructor | Description |
|---|---|
| SearchReport() |
| Method | Description |
|---|---|
| getStartTime() | Gets the start time of the search. |
| getEndTime() | Gets the end time of the search. |
| getSearchDuration() | Gets the search duration in seconds. |
| getDocumentCount() | Gets the number of documents found. |
| getOccurrenceCount() | Gets the total number of occurrences found. |
| getTextQuery() | Gets the search query in text form. |
| getObjectQuery() | Gets the search query in object form. |
| getSearchOptions() | Gets the search options. |
| toString() | Returns a String that represents the current SearchReport . |
public SearchReport()
public abstract Date getStartTime()
Gets the start time of the search.
Returns: java.util.Date - The start time of the search.
public abstract Date getEndTime()
Gets the end time of the search.
Returns: java.util.Date - The end time of the search.
public abstract double getSearchDuration()
Gets the search duration in seconds.
Returns: double - The search duration in seconds.
public abstract int getDocumentCount()
Gets the number of documents found.
Returns: int - The number of documents found.
public abstract int getOccurrenceCount()
Gets the total number of occurrences found.
Returns: int - The total number of occurrences found.
public abstract String getTextQuery()
Gets the search query in text form.
Returns: java.lang.String - The search query in text form.
public abstract SearchQuery getObjectQuery()
Gets the search query in object form.
Returns: SearchQuery - The search query in object form.
public abstract SearchOptions getSearchOptions()
Gets the search options.
Returns: SearchOptions - The search options.
public abstract String toString()
Returns a String that represents the current SearchReport .
Returns: java.lang.String - A String that represents the current SearchReport .
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.