SearchReport

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();
 }
 

Constructors

Constructor Description
SearchReport()

Methods

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 .

SearchReport()

public SearchReport()

getStartTime()

public abstract Date getStartTime()

Gets the start time of the search.

Returns: java.util.Date - The start time of the search.

getEndTime()

public abstract Date getEndTime()

Gets the end time of the search.

Returns: java.util.Date - The end time of the search.

getSearchDuration()

public abstract double getSearchDuration()

Gets the search duration in seconds.

Returns: double - The search duration in seconds.

getDocumentCount()

public abstract int getDocumentCount()

Gets the number of documents found.

Returns: int - The number of documents found.

getOccurrenceCount()

public abstract int getOccurrenceCount()

Gets the total number of occurrences found.

Returns: int - The total number of occurrences found.

getTextQuery()

public abstract String getTextQuery()

Gets the search query in text form.

Returns: java.lang.String - The search query in text form.

getObjectQuery()

public abstract SearchQuery getObjectQuery()

Gets the search query in object form.

Returns: SearchQuery - The search query in object form.

getSearchOptions()

public abstract SearchOptions getSearchOptions()

Gets the search options.

Returns: SearchOptions - The search options.

toString()

public abstract String toString()

Returns a String that represents the current SearchReport .

Returns: java.lang.String - A String that represents the current SearchReport .