Class WebSearchOrganicResult

  • All Implemented Interfaces:

    
    public class WebSearchOrganicResult
    
                        

    Represents an organic search results are the web pages that are returned by the search engine in response to a search query. This includes the title, URL, snippet and/or content, and metadata of the web page.

    These results are typically ranked by relevance to the search query.

    • Constructor Detail

      • WebSearchOrganicResult

        WebSearchOrganicResult(String title, URI url)
        Constructs a WebSearchOrganicResult object with the given title and URL.
        Parameters:
        title - The title of the search result.
        url - The URL associated with the search result.
      • WebSearchOrganicResult

        WebSearchOrganicResult(String title, URI url, String snippet, String content)
        Constructs a WebSearchOrganicResult object with the given title, URL, snippet and/or content.
        Parameters:
        title - The title of the search result.
        url - The URL associated with the search result.
        snippet - The snippet of the search result, in plain text.
        content - The most query related content from the scraped url.
      • WebSearchOrganicResult

        WebSearchOrganicResult(String title, URI url, String snippet, String content, Map<String, String> metadata)
        Constructs a WebSearchOrganicResult object with the given title, URL, snippet and/or content, and metadata.
        Parameters:
        title - The title of the search result.
        url - The URL associated with the search result.
        snippet - The snippet of the search result, in plain text.
        content - The most query related content from the scraped url.
        metadata - The metadata associated with the search result.
    • Method Detail

      • title

         String title()

        Returns the title of the web page.

        Returns:

        The title of the web page.

      • url

         URI url()

        Returns the URL associated with the web page.

        Returns:

        The URL associated with the web page.

      • snippet

         String snippet()

        Returns the snippet associated with the web page.

        Returns:

        The snippet associated with the web page.

      • content

         String content()

        Returns the content scraped from the web page.

        Returns:

        The content scraped from the web page.

      • metadata

         Map<String, String> metadata()

        Returns the result metadata associated with the search result.

        Returns:

        The result metadata associated with the search result.

      • toTextSegment

         TextSegment toTextSegment()

        Converts this WebSearchOrganicResult to a TextSegment.

        Returns:

        The TextSegment representation of this WebSearchOrganicResult.

      • toDocument

         Document toDocument()

        Converts this WebSearchOrganicResult to a Document.

        Returns:

        The Document representation of this WebSearchOrganicResult.

      • from

         static WebSearchOrganicResult from(String title, URI url)

        Creates a WebSearchOrganicResult object from the given title and URL.

        Parameters:
        title - The title of the search result.
        url - The URL associated with the search result.
        Returns:

        The created WebSearchOrganicResult object.

      • from

         static WebSearchOrganicResult from(String title, URI url, String snippet, String content)

        Creates a WebSearchOrganicResult object from the given title, URL, snippet and/or content.

        Parameters:
        title - The title of the search result.
        url - The URL associated with the search result.
        snippet - The snippet of the search result, in plain text.
        content - The most query related content from the scraped url.
        Returns:

        The created WebSearchOrganicResult object.

      • from

         static WebSearchOrganicResult from(String title, URI url, String snippet, String content, Map<String, String> metadata)

        Creates a WebSearchOrganicResult object from the given title, URL, snippet and/or content, and result metadata.

        Parameters:
        title - The title of the search result.
        url - The URL associated with the search result.
        snippet - The snippet of the search result, in plain text.
        content - The most query related content from the scraped url.
        metadata - The metadata associated with the search result.
        Returns:

        The created WebSearchOrganicResult object.