Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* keyword retrieval example

* keyword retrieval example

* keyword retrieval example

* more explanation

---------

Co-authored-by: Stefano Fiorucci <[email protected]>
  • Loading branch information
jlonge4 and anakin87 authored May 9, 2024
1 parent 7596976 commit 37e6b8d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion integrations/pgvector-documentstore.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ indexing.run({"converter": {"sources": file_paths}})
```
### Retrieval from PgvectorDocumentStore
You can retrieve Documents similar to a given query using a simple Pipeline.
You can retrieve semantically similar documents to a given query using a simple pipeline that includes the `PgvectorEmbeddingRetriever`.
```python
from haystack.components.embedders import SentenceTransformersTextEmbedder
Expand All @@ -99,6 +99,15 @@ querying.connect("embedder", "retriever")
results = querying.run({"embedder": {"text": "my query"}})
```
You can also retrieve Documents based on keyword matching with the `PgvectorKeywordRetriever`.
```python
from haystack_integrations.components.retrievers.pgvector import PgvectorKeywordRetriever
retriever = PgvectorKeywordRetriever(document_store=document_store, top_k=3))
results = retriever.run(query="my query")
```
## Examples
You can find a code example showing how to use the Document Store and the Retriever under the `examples/` folder of [this repo](https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/pgvector).
Expand Down

0 comments on commit 37e6b8d

Please sign in to comment.