com.groupdocs.search.common

Class SearchReport



  • public class SearchReport
    extends Object

    Represents a detailed information on a search operation.

    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 Detail

      • SearchReport

        protected SearchReport(com.aspose.ms.System.DateTime startTime,
                    com.aspose.ms.System.DateTime endTime,
                    String textQuery,
                    SearchOptions searchOptions,
                    SearchResult searchResult)
      • SearchReport

        protected SearchReport(com.aspose.ms.System.DateTime startTime,
                    com.aspose.ms.System.DateTime endTime,
                    SearchQuery objectQuery,
                    SearchOptions searchOptions,
                    SearchResult searchResult)
    • Method Detail

      • getStartTime

        public final Date getStartTime()

        Gets the start time of the search.

        Returns:
        The start time of the search.
      • getEndTime

        public final Date getEndTime()

        Gets the end time of the search.

        Returns:
        The end time of the search.
      • getSearchDuration

        public final double getSearchDuration()

        Gets the search duration in seconds.

        Returns:
        The search duration in seconds.
      • getDocumentCount

        public final int getDocumentCount()

        Gets the number of documents found.

        Returns:
        The number of documents found.
      • getOccurrenceCount

        public final int getOccurrenceCount()

        Gets the total number of occurrences found.

        Returns:
        The total number of occurrences found.
      • getTextQuery

        public final String getTextQuery()

        Gets the search query in text form.

        Returns:
        The search query in text form.
      • getObjectQuery

        public final SearchQuery getObjectQuery()

        Gets the search query in object form.

        Returns:
        The search query in object form.
      • getSearchOptions

        public final SearchOptions getSearchOptions()

        Gets the search options.

        Returns:
        The search options.
      • toString

        public String toString()

        Returns a String that represents the current SearchReport.

        Overrides:
        toString in class Object
        Returns:
        A String that represents the current SearchReport.