1WWW::SearchResult(3)  User Contributed Perl Documentation WWW::SearchResult(3)
2
3
4

NAME

6       WWW::SearchResult - class for results returned from WWW::Search
7

SYNOPSIS

9           require WWW::Search;
10           require WWW::SearchResult;
11           $search = new WWW::Search;
12           $search->native_query(WWW::Search::escape_query($query));
13           # Get first result:
14           $result = $search->next_result();
15

DESCRIPTION

17       A framework for returning the results of "WWW::Search".
18

SEE ALSO

20       WWW::Search
21

REQUIRED RESULTS

23       The particular fields returned in a result are backend- (search
24       engine-) dependent.  However, all search engines are required to return
25       a url and title.  (This list may grow in the future.)
26

METHODS AND FUNCTIONS

28   new
29       To create a new WWW::SearchResult, call
30
31           $result = new WWW::SearchResult();
32
33   url
34       Returns the primary URL.  Note that there may be a list of urls, see
35       also methods "urls" and "add_url".  Nothing special is guaranteed about
36       the primary URL other than that it is the first one returned by the
37       back end.
38
39       Every result is required to have at least one URL.
40
41   add_url
42       Add a URL to the list.
43
44   urls
45       Return a reference to the list of urls.  There is also a primary URL
46       ("url").
47
48   add_related_url
49       Add a URL to the related_url list.
50
51   related_urls
52       Return a reference to the list of related urls.
53
54   add_related_title
55       Add a title to the list or related titles.
56
57   related_titles
58       Return a reference to the list of related titles.
59
60   title, description, score, change_date, index_date, size, raw
61       Set or get attributes of the result.
62
63       None of these attributes is guaranteed to be provided by a given
64       backend.  If an attribute is not provided its method will return
65       "undef".
66
67       Typical contents of these attributes:
68
69       title   The title of the hit result (typically that provided by the
70               'TITLE' HTML tag).
71
72       description
73               A brief description of the result, as provided (or not) by the
74               search engine.  Often the first few sentences of the document.
75
76       source  Source is either the base url for this result (as listed on the
77               search engine's results page) or another copy of the full url
78               path of the result.  It might also indicate the source site
79               name or address whence the result came, for example, 'CNN' or
80               'http://www.cnn.com' if the search result page said "found at
81               CNN.com".
82
83               This value is backend-specific; in fact very few backends set
84               this value.
85
86       add_sources
87               Same meaning as source above, for adding sources in case there
88               are potentially multiple sources.
89
90       sources Returns a reference to the list of sources.
91
92       score   A backend specific, numeric score of the search result.  The
93               exact range of scores is search-engine specific.  Usually
94               larger scores are better, but this is no longer required.  See
95               normalized_score for a backend independent score.
96
97       normalized_score
98               This is intended to be a backend-independent score of the
99               search result.  The range of this score is between 0 and 1000.
100               Higher values indicate better quality results.
101
102               This is not really implemented since no one has created an
103               backend-independent ranking algorithm.
104
105       change_date
106               When the result was last changed.  Typically this is the
107               modification time of the destination web page.
108
109       index_date
110               When the search engine indexed the result.
111
112       size    The approximate size of the result, in bytes.  This is only an
113               approximation because search backends often report the size as
114               "18.4K"; the best we can do with that number is return it as
115               the value of 18.4 * 1024.
116
117       raw     The raw HTML for the entire result.  Raw should be exactly the
118               raw HTML for one entry.  It should not include list or table
119               setup commands (like ul or table tags), but it may include list
120               item or table data commands (like li, tr, or td).  Whether raw
121               contains a list entry, table row, br-separated lines, or plain
122               text is search-engine dependent.  In fact, many backends do not
123               even return it at all.
124
125       as_HTML Convert the search result to a human-readable form, decorated
126               with HTML for pretty-printing.
127
128   Others
129       More attributes of the result.  Backend-specific.  Refer to the
130       documentation of each backend for details.
131
132       bid_amount
133       bid_count
134       bidder
135       category
136       company
137       end_date
138       image_url
139       item_number
140       location
141       question_count
142       seller
143       shipping
144       sold
145       start_date
146       thumb_url
147       watcher_count
148

AUTHOR

150       WWW::SearchResult was written by John Heidemann.  WWW::SearchResult is
151       maintained by Martin Thurn.
152
153
154
155perl v5.30.0                      2019-07-26              WWW::SearchResult(3)
Impressum