<!-- Source: https://docs.squirro.com/en/latest/api/squirro.lib.nlp.steps.loaders.SquirroQueryLoader.html -->
# SquirroQueryLoader

**`class SquirroQueryLoader(config)`**

Bases: [`Loader`](squirro.lib.nlp.steps.loaders.Loader.md#squirro.lib.nlp.steps.loaders.Loader)

Loads items from a Squirro instance using the [`SquirroClient`](../technical/api/squirro_client/squirroclient-class.md#squirro_client.SquirroClient) and transforms the items into [`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document) items.

**Note** - The fields client_id, client_secret, cluster, token and project_id do not need to be set if it is used inside the Squirro machinelearning service

Parameters

- `type` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – squirro_query
- `batch_size` ([`int`](https://docs.python.org/3.11/library/functions.html#int)`, ``1000`) – size of Squirro query batch
- `client_id` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``None`) – Squirro client id
- `client_secret` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``None`) – Squirro client secret
- `cluster` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – Squirro cluster
- `token` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – Squirro token
- `project_id` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – id of Squirro project
- `merge_sub_items` ([`bool`](https://docs.python.org/3.11/library/functions.html#bool)`, ``False`) – indicates if loading content from sub_items and returning as merged field is applied

**Example**

```json
{
    "step": "loader",
    "type": "squirro_query",
    "batch_size": 100,
    "cluster": "CLUSTER",
    "token": "TOKEN",
    "project_id": "PROJECT_ID"
    "fields": [ "body", "keywords.label" ]
}
```

Methods SummaryMethods Documentation

**`process(dataset)`**

Process a query and yield documents.

**Arguments**

dataset (dict): Dictionary containing query strings

Yields

_Document_ – A document from a query
