mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Feat: Add metadata filtering function for /api/v1/retrieval (#9877)
-Added the metadata_dedition parameter in the document retrieval interface to filter document metadata -Updated the API documentation and added explanations for the metadata_dedition parameter ### What problem does this PR solve? Make /api/v1/retrieval api also can use metadata filter ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1808,7 +1808,8 @@ Retrieves chunks from specified datasets.
|
||||
- `"rerank_id"`: `string`
|
||||
- `"keyword"`: `boolean`
|
||||
- `"highlight"`: `boolean`
|
||||
- `"cross_languages"`: `list[string]`
|
||||
- `"cross_languages"`: `list[string]`
|
||||
- `"metadata_condition"`: `object`
|
||||
|
||||
##### Request example
|
||||
|
||||
@ -1855,7 +1856,8 @@ curl --request POST \
|
||||
- `false`: Disable highlighting of matched terms (default).
|
||||
- `"cross_languages"`: (*Body parameter*) `list[string]`
|
||||
The languages that should be translated into, in order to achieve keywords retrievals in different languages.
|
||||
|
||||
- `"metadata_condition"`: (*Body parameter*), `object`
|
||||
The metadata condition for filtering chunks.
|
||||
#### Response
|
||||
|
||||
Success:
|
||||
|
||||
@ -921,7 +921,7 @@ chunk.update({"content":"sdfx..."})
|
||||
### Retrieve chunks
|
||||
|
||||
```python
|
||||
RAGFlow.retrieve(question:str="", dataset_ids:list[str]=None, document_ids=list[str]=None, page:int=1, page_size:int=30, similarity_threshold:float=0.2, vector_similarity_weight:float=0.3, top_k:int=1024,rerank_id:str=None,keyword:bool=False,highlight:bool=False) -> list[Chunk]
|
||||
RAGFlow.retrieve(question:str="", dataset_ids:list[str]=None, document_ids=list[str]=None, page:int=1, page_size:int=30, similarity_threshold:float=0.2, vector_similarity_weight:float=0.3, top_k:int=1024,rerank_id:str=None,keyword:bool=False,cross_languages:list[str]=None,metadata_condition: dict=None) -> list[Chunk]
|
||||
```
|
||||
|
||||
Retrieves chunks from specified datasets.
|
||||
@ -971,17 +971,14 @@ Indicates whether to enable keyword-based matching:
|
||||
- `True`: Enable keyword-based matching.
|
||||
- `False`: Disable keyword-based matching (default).
|
||||
|
||||
##### highlight: `bool`
|
||||
|
||||
Specifies whether to enable highlighting of matched terms in the results:
|
||||
|
||||
- `True`: Enable highlighting of matched terms.
|
||||
- `False`: Disable highlighting of matched terms (default).
|
||||
|
||||
##### cross_languages: `list[string]`
|
||||
|
||||
The languages that should be translated into, in order to achieve keywords retrievals in different languages.
|
||||
|
||||
##### metadata_condition: `dict`
|
||||
|
||||
filter condition for meta_fields
|
||||
|
||||
#### Returns
|
||||
|
||||
- Success: A list of `Chunk` objects representing the document chunks.
|
||||
|
||||
Reference in New Issue
Block a user