Class WebSearchResults
-
- All Implemented Interfaces:
public class WebSearchResultsRepresents the response of a web search performed. This includes the list of organic search results, information about the search, and pagination information.
WebSearchResults follow opensearch foundation standard implemented by most web search engine libs like Google, Bing, Yahoo, etc. OpenSearch#response
The organic search results are the web pages that are returned by the search engine in response to a search query. These results are typically ranked by relevance to the search query.
-
-
Constructor Summary
Constructors Constructor Description WebSearchResults(WebSearchInformationResult searchInformation, List<WebSearchOrganicResult> results)Constructs a new instance of WebSearchResults. WebSearchResults(Map<String, Object> searchMetadata, WebSearchInformationResult searchInformation, List<WebSearchOrganicResult> results)Constructs a new instance of WebSearchResults.
-
Method Summary
Modifier and Type Method Description Map<String, Object>searchMetadata()Gets the metadata associated with the web search. WebSearchInformationResultsearchInformation()Gets the information about the web search. List<WebSearchOrganicResult>results()Gets the list of organic search results. booleanequals(Object o)inthashCode()StringtoString()List<TextSegment>toTextSegments()Converts the organic search results to a list of text segments. List<Document>toDocuments()Converts the organic search results to a list of documents. static WebSearchResultsfrom(WebSearchInformationResult searchInformation, List<WebSearchOrganicResult> results)Creates a new instance of WebSearchResults from the specified parameters. static WebSearchResultsfrom(Map<String, Object> searchMetadata, WebSearchInformationResult searchInformation, List<WebSearchOrganicResult> results)Creates a new instance of WebSearchResults from the specified parameters. -
-
Constructor Detail
-
WebSearchResults
WebSearchResults(WebSearchInformationResult searchInformation, List<WebSearchOrganicResult> results)
Constructs a new instance of WebSearchResults.- Parameters:
searchInformation- The information about the web search.results- The list of organic search results.
-
WebSearchResults
WebSearchResults(Map<String, Object> searchMetadata, WebSearchInformationResult searchInformation, List<WebSearchOrganicResult> results)
Constructs a new instance of WebSearchResults.- Parameters:
searchMetadata- The metadata associated with the web search.searchInformation- The information about the web search.results- The list of organic search results.
-
-
Method Detail
-
searchMetadata
Map<String, Object> searchMetadata()
Gets the metadata associated with the web search.
- Returns:
The metadata associated with the web search.
-
searchInformation
WebSearchInformationResult searchInformation()
Gets the information about the web search.
- Returns:
The information about the web search.
-
results
List<WebSearchOrganicResult> results()
Gets the list of organic search results.
- Returns:
The list of organic search results.
-
hashCode
int hashCode()
-
toTextSegments
List<TextSegment> toTextSegments()
Converts the organic search results to a list of text segments.
- Returns:
The list of text segments.
-
toDocuments
List<Document> toDocuments()
Converts the organic search results to a list of documents.
- Returns:
The list of documents.
-
from
static WebSearchResults from(WebSearchInformationResult searchInformation, List<WebSearchOrganicResult> results)
Creates a new instance of WebSearchResults from the specified parameters.
- Parameters:
searchInformation- The information about the web search.results- The list of organic search results.- Returns:
The new instance of WebSearchResults.
-
from
static WebSearchResults from(Map<String, Object> searchMetadata, WebSearchInformationResult searchInformation, List<WebSearchOrganicResult> results)
Creates a new instance of WebSearchResults from the specified parameters.
- Parameters:
searchMetadata- The metadata associated with the search results.searchInformation- The information about the web search.results- The list of organic search results.- Returns:
The new instance of WebSearchResults.
-
-
-
-