Skip to content

✨ Image tab category search results for the search page #556

Open
@neon-mmd

Description

@neon-mmd

Description

Work Expected From The Issue

Provide image tab category search results for the new image tab category on the search page by providing an image category in the config with the search engines to be enabled in order to get image search results. Also, provide code to fetch them from the search engines.

The issue expects the following files to be changed/modified:

  • src/results/aggregator.rs
  • src/config/parser.rs
  • websurfx/config.rs
  • src/models/server_models.rs

Note

All the files that are expected to be changed are located under the codebase (websurfx directory).

Reason Behind These Changes

The reason behind having these changes is to provide image search results for the new image category on the search page which can provide more search results type for the user and improve the user experience.

Sample Code

Here is the sample code snippets which provides a general idea of what should be implemented for the above requested work:

Code snippet for search engine categories

upstream_search_engines = {
    general = {
        DuckDuckGo = true,
        Searx = false,
        Brave = false,
        Startpage = false,
        LibreX = false,
        Mojeek = false,
        Bing = false,
    },
    images = {
        DuckDuckGo = true,
    }
} -- select the upstream search engines from which the results should be fetched.

Code snippet for SearchParams struct

/// A named struct which deserializes all the user provided search parameters and stores them.
#[derive(Deserialize)]
pub struct SearchParams {
    /// It stores the search parameter option `q` (or query in simple words)
    /// of the search url.
    pub q: Option<String>,
    /// It stores the search parameter `page` (or pageno in simple words)
    /// of the search url.
    pub page: Option<u32>,
    /// It stores the search parameter `safesearch` (or safe search level in simple words) of the
    /// search url.
    pub safesearch: Option<u8>,
    pub type: Option<u8>,
}

Screenshots

No response

Do you want to work on this issue?

None

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions