Class BaiDuQuery.SearchResult

    • Field Detail

      • serialVersionUID

        public static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.

        Functional Interfaces are usually not thought of as Data Objects that need to be saved, stored and retrieved; however, having the ability to store intermediate results along with the lambda-functions that helped get those results can make debugging easier.
        See Also:
        Constant Field Values
        Exact Field Declaration Expression:
         public static final long serialVersionUID = 1;
      • url

        🡅  🡇    
        public final java.lang.String url
        This is the link of 'this' search result.
        Exact Field Declaration Expression:
         public final String url;
      • title

        🡅  🡇    
        public final java.lang.String title
        This is the "Anchor Text" that 百度 provided for this link. To be specific, it is the text between the <A HREF=url> and the </A>.
        Exact Field Declaration Expression:
         public final String title;
      • subResults

        🡅  🡇    
        public final BaiDuQuery.SearchResult[] subResults
        Usually, this array will be null. Note, null will be used in place of a zero length array. There are some sites for which a search-result would have multiple, or even numerous matches for a given search-String. When a search using 百度 provides more than one result, the list of 'Additional Matches' are scraped and put into this array.
        Exact Field Declaration Expression:
         public final SearchResult[] subResults;
    • Method Detail

      • toString

        public java.lang.String toString()
        Converts this search result to a simple String
        toString in class java.lang.Object
        A String version of this Search Result.
        Exact Method Body:
         if (subResults == null) return title + '\n' + url + '\n';
         StringBuilder sb = new StringBuilder();
         for (SearchResult sr : subResults)
             sb.append('\t' + sr.title + "\n\t" + sr.url + '\n');
         return title + '\n' + url + '\n' + sb.toString();