> For the complete documentation index, see [llms.txt](https://red-3.gitbook.io/searchx/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://red-3.gitbook.io/searchx/client/search.md).

# search

#### `search(query: str, type: str = "search", pages: int = 1) -> Search`

The `search` method allows you to perform search queries through Google and return results for both standard web search and image search.

**Parameters:**

* `query` (str): The search query string.
* `type` (str): The type of search, default is `"search"`. You can set `"images"` for image search.
* `pages` (int): The number of result pages to process. Default is 1 page.

**Description:**

For standard web search, `search` returns a list of links to the found web pages and their brief descriptions.\
For image search, the method retrieves links to the images.

**Example Usage:**

```python
from searchx import Client

client = Client()

# Search for web pages with the query "Python programming"
search_results = client.search("Python programming")
for result in search_results:
    print(f"URL: {result['url']}, Description: {result['description']}")

# Search for images with the query "cute cats"
image_results = client.search("cute cats", type="images", pages=2)
for result in image_results:
    print(f"Image URL: {result['url']}")
```

**How the Method Works:**

**Web Search**:\
The method sends a GET request to Google with the specified query and collects links (`url`) and descriptions (`description`) for each result. It returns up to 10 results per page.

**Image Search**:\
The method sends a GET request to Google Images and collects image URLs. Each search page contains up to 35 images.

**Note:**

* The method uses the `cloudscraper` library to bypass Cloudflare protection.
* The `user-agent` header is dynamically selected using the `fake_useragent` library.

**Return Value:**

The method returns an instance of the `Search` class, containing a list of search results with `url` and `description` fields.
