#Combining full text search and vector search results
1 messages · Page 1 of 1 (latest)
Hi @bitter violet. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Convex provides both Full Text Search and Vector Search capabilities, which can be used separately based on your application's requirements. However, the knowledge sources provided do not contain specific examples or documentation on combining the results of both Full Text Search and Vector Search.
Here's a brief overview of both:
-
Full Text Search: This feature allows you to perform keyword and phrase search within your documents. It supports both prefix and fuzzy matching. An example of using Full Text Search can be found in the Complex Filters in Convex (https://stack.convex.dev/complex-filters-in-convex#advanced-indexes) documentation. Here, tags are stored in a space-separated string and a full text search is performed to find matching tags.
-
Vector Search: This feature enables searching for documents based on their semantic meaning. It uses vector embeddings to calculate similarity and retrieve documents that are similar to a given query. Examples of using Vector Search can be found in the Running Vector Searches (https://docs.convex.dev/search/vector-search#running-vector-searches) and How I built NotesGPT (https://stack.convex.dev/full-stack-ai-voice-note-taking-app#vector-search) documentation.
While there's no direct example of combining these two search methods, you could potentially perform both searches separately and then merge and sort the results based on your application's logic. However, this would depend on the specific requirements of your application.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@bitter violet kapa.ai is still learning and improving, please let us know how it did by reacting below
@oak rune Ok so any commentary or examples on searching separately, and then merging?
Let me check the knowledge base for you. One moment! :books:
While there are no direct examples in the provided knowledge sources of performing separate searches and then merging the results, you can certainly do this in your application's logic. Here's a general approach:
-
Perform the Full Text Search: Use Convex's Full Text Search capabilities to search for documents based on keywords or phrases. This will return a set of documents that match your search criteria.
-
Perform the Vector Search: Use Convex's Vector Search capabilities to search for documents based on their semantic meaning. This will return a set of documents that are semantically similar to your query.
-
Merge the Results: Once you have the results from both searches, you can merge them in your application. This could be as simple as concatenating the two result sets, or you could implement more complex logic to rank and sort the results based on your specific requirements.
Remember, the specifics of how you perform the searches and merge the results will depend on your application's requirements and the structure of your data.