Find answers from the community

Updated 3 months ago

```

Plain Text
index = GPTSimpleKeywordTableIndex(nodes=nodes,
                            storage_context=storage_context,
                            service_context=service_context,
                            show_progress=True
                            )

retriever = index.as_retriever()
nodes = retriever.retrieve("formation")


Hello,

I need your help for my use case.

How to retrieve all matching nodes; not only 2 or similarity_top_k. I want to retrieve all nodes matching my query.
L
i
7 comments
You are using a keyword index

So it already returns all nodes with matching keywords πŸ‘€
Really? because when I check in the text from my nodes I found much more nodes than the want returns.

And what if I use GPTVectorStoreIndex?

Here is my use case. I have a data base with job description. I want to retrieve all nodes releated to the query via semantic or keyword search.
How it works here is it takes your query, extracts keywords, and retrieves nodes that have the same keywords from the table. Pretty basic. You can see when you query I think which keywords it extracted too

If you want to combine keyword/semantic, maybe try BM25 + vector store index (you could skip the re-ranking here)
https://gpt-index.readthedocs.io/en/stable/examples/retrievers/bm25_retriever.html#advanced-hybrid-retriever-re-ranking
Thanks alot for our answer. So we do not need in this case to add similarity top k param right ?
yea correct. Right now, your keywrod index will just return every matching node
And how to check extracted keywords from the query?
it should be printing them to the console, but if not, run this first

Plain Text
import logging
import sys

logging.basicConfig(stream=sys.stdout, level=logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
Add a reply
Sign up and join the conversation on Discord