Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/develop/ai/redisvl/api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Reference documentation for the RedisVL API.

* [Schema](schema/)
* [IndexSchema](schema/#indexschema)
* [Index-Level Stopwords Configuration](schema/#index-level-stopwords-configuration)
* [Defining Fields](schema/#defining-fields)
* [Basic Field Types](schema/#basic-field-types)
* [Vector Field Types](schema/#vector-field-types)
Expand Down
30 changes: 26 additions & 4 deletions content/develop/ai/redisvl/api/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ expression.
**TypeError** – If filter_expression is not of type redisvl.query.FilterExpression

#### `NOTE`
Learn more about vector queries in Redis: [https://redis.io/docs/interact/search-and-query/search/vectors/#knn-search](https://redis.io/docs/interact/search-and-query/search/vectors/#knn-search)
Learn more about vector queries in Redis: [https://redis.io/docs/latest/develop/ai/search-and-query/vectors/#knn-vector-search](https://redis.io/docs/latest/develop/ai/search-and-query/vectors/#knn-vector-search)

#### `dialect(dialect)`

Expand Down Expand Up @@ -758,11 +758,17 @@ Instantiates a AggregateHybridQuery object.
* **dtype** (*str* *,* *optional*) – The data type of the vector. Defaults to "float32".
* **num_results** (*int* *,* *optional*) – The number of results to return. Defaults to 10.
* **return_fields** (*Optional* *[* *List* *[* *str* *]* *]* *,* *optional*) – The fields to return. Defaults to None.
* **stopwords** (*Optional* *[* *Union* *[* *str* *,* *Set* *[* *str* *]* *]* *]* *,* *optional*) – The stopwords to remove from the
* **stopwords** (*Optional* *[* *Union* *[* *str* *,* *Set* *[* *str* *]* *]* *]* *,* *optional*) –

The stopwords to remove from the
provided text prior to searchuse. If a string such as "english" "german" is
provided then a default set of stopwords for that language will be used. if a list,
set, or tuple of strings is provided then those will be used as stopwords.
Defaults to "english". if set to "None" then no stopwords will be removed.

Note: This parameter controls query-time stopword filtering (client-side).
For index-level stopwords configuration (server-side), see IndexInfo.stopwords.
Using query-time stopwords with index-level STOPWORDS 0 is counterproductive.
* **dialect** (*int* *,* *optional*) – The Redis dialect version. Defaults to 2.
* **text_weights** (*Optional* *[* *Dict* *[* *str* *,* *float* *]* *]*) – The importance weighting of individual words
within the query text. Defaults to None, as no modifications will be made to the
Expand Down Expand Up @@ -974,6 +980,11 @@ Get the text weights.
* **Return type:**
Dictionary of word

#### `NOTE`
The `stopwords` parameter in [HybridQuery](#hybridquery) (and `AggregateHybridQuery`) controls query-time stopword filtering (client-side).
For index-level stopwords configuration (server-side), see `redisvl.schema.IndexInfo.stopwords`.
Using query-time stopwords with index-level `STOPWORDS 0` is counterproductive.

## TextQuery

### `class TextQuery(text, text_field_name, text_scorer='BM25STD', filter_expression=None, return_fields=None, num_results=10, return_score=True, dialect=2, sort_by=None, in_order=False, params=None, stopwords='english', text_weights=None)`
Expand Down Expand Up @@ -1032,11 +1043,17 @@ A query for running a full text search, along with an optional filter expression
the offsets between them. Defaults to False.
* **params** (*Optional* *[* *Dict* *[* *str* *,* *Any* *]* *]* *,* *optional*) – The parameters for the query.
Defaults to None.
* **stopwords** (*Optional* *[* *Union* *[* *str* *,* *Set* *[* *str* *]* *]*) – The set of stop words to remove
from the query text. If a language like ‘english’ or ‘spanish’ is provided
* **stopwords** (*Optional* *[* *Union* *[* *str* *,* *Set* *[* *str* *]* *]*) –

The set of stop words to remove
from the query text (client-side filtering). If a language like ‘english’ or ‘spanish’ is provided
a default set of stopwords for that language will be used. Users may specify
their own stop words by providing a List or Set of words. if set to None,
then no words will be removed. Defaults to ‘english’.

Note: This parameter controls query-time stopword filtering (client-side).
For index-level stopwords configuration (server-side), see IndexInfo.stopwords.
Using query-time stopwords with index-level STOPWORDS 0 is counterproductive.
* **text_weights** (*Optional* *[* *Dict* *[* *str* *,* *float* *]* *]*) – The importance weighting of individual words
within the query text. Defaults to None, as no modifications will be made to the
text_scorer score.
Expand Down Expand Up @@ -1308,6 +1325,11 @@ Get the text weights.
* **Return type:**
Dictionary of word

#### `NOTE`
The `stopwords` parameter in [TextQuery](#textquery) controls query-time stopword filtering (client-side).
For index-level stopwords configuration (server-side), see `redisvl.schema.IndexInfo.stopwords`.
Using query-time stopwords with index-level `STOPWORDS 0` is counterproductive.

## FilterQuery

### `class FilterQuery(filter_expression=None, return_fields=None, num_results=10, dialect=2, sort_by=None, in_order=False, params=None)`
Expand Down
39 changes: 39 additions & 0 deletions content/develop/ai/redisvl/api/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,45 @@ Configuration for the model, should be a dictionary conforming to [ConfigDict][p

Version of the underlying index schema.

## Index-Level Stopwords Configuration

The `IndexInfo` class supports index-level stopwords configuration through
the `stopwords` field. This controls which words are filtered during indexing
(server-side), as opposed to query-time filtering (client-side).

**Configuration Options:**

- `None` (default): Use Redis default stopwords (~300 common words)
- `[]` (empty list): Disable stopwords completely (`STOPWORDS 0`)
- Custom list: Specify your own stopwords (e.g., `["the", "a", "an"]`)

**Example:**

```python
from redisvl.schema import IndexSchema

# Disable stopwords to search for phrases like "Bank of Glasberliner"
schema = IndexSchema.from_dict({
"index": {
"name": "company-idx",
"prefix": "company",
"stopwords": [] # STOPWORDS 0
},
"fields": [
{"name": "name", "type": "text"}
]
})
```

**Important Notes:**

- Index-level stopwords affect what gets indexed (server-side)
- Query-time stopwords (in `TextQuery` and `AggregateHybridQuery`) affect what gets searched (client-side)
- Using query-time stopwords with index-level `STOPWORDS 0` is counterproductive

For detailed information about stopwords configuration and best practices, see the
Advanced Queries user guide (`docs/user_guide/11_advanced_queries.ipynb`).

## Defining Fields

Fields in the schema can be defined in YAML format or as a Python dictionary, specifying a name, type, an optional path, and attributes for customization.
Expand Down
Loading