Comments (5)
Yes we have plans to implement this, it's already on our roadmap for join.
from typesense.
+1 for this feature. it would be incredibly helpful for us to avoid the kind of duplication mentioned by the OP - but I guess there were good reasons for not including it with the join work... @kishorenc are there any existing plans to implement this?
from typesense.
this would be awesome!
from typesense.
Hi @Napam I believe this can be achieved using the "filter_by" field instead of the "q" field in the query to search using the author name from the books collection itself as follows,
Query:
curl "http://localhost:8108/multi_search" -X POST
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}"
-d '{
"searches": [
{
"q": "*",
"collection": "books",
"include_fields": "$authors(first_name,last_name)",
"filter_by": "$authors(first_name:enid&&last_name:blyton)"
}
]
}'
Response:
{
"facet_counts": [],
"found": 2,
"hits": [
{
"document": {
"author_id": "1",
"authors": {
"first_name": "Enid",
"last_name": "Blyton"
},
"id": "2",
"title": "The Island of Adventure"
},
"highlight": {},
"highlights": []
},
{
"document": {
"author_id": "1",
"authors": {
"first_name": "Enid",
"last_name": "Blyton"
},
"id": "1",
"title": "The Mountain"
},
"highlight": {},
"highlights": []
}
],
"out_of": 10,
"page": 1,
"request_params": {
"collection_name": "books",
"first_q": "",
"per_page": 10,
"q": ""
},
"search_cutoff": false,
"search_time_ms": 0
}
from typesense.
Hi @Napam I believe this can be achieved using the "filter_by" field instead of the "q" field in the query to search using the author name from the books collection itself as follows,
Query:
curl "http://localhost:8108/multi_search" -X POST -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{ "searches": [ { "q": "*", "collection": "books", "include_fields": "$authors(first_name,last_name)", **"filter_by": "$authors(first_name:enid&&last_name:blyton)"** } ] }'
Response:
{ "facet_counts": [], "found": 2, "hits": [ { "document": { "author_id": "1", "authors": { "first_name": "Enid", "last_name": "Blyton" }, "id": "2", "title": "The Island of Adventure" }, "highlight": {}, "highlights": [] }, { "document": { "author_id": "1", "authors": { "first_name": "Enid", "last_name": "Blyton" }, "id": "1", "title": "The Mountain" }, "highlight": {}, "highlights": [] } ], "out_of": 10, "page": 1, "request_params": { "collection_name": "books", "first_q": "_", "per_page": 10, "q": "_" }, "search_cutoff": false, "search_time_ms": 0 }
Hi @abiudmani, thanks for the tip, but this solution won't work in the context of simple search bar. Using a simple search bar we won't directly specify who the author is, we just want to search "enid", and it should just figure out all the books written by Enid.
Also, using the filter_by
is not typo tolerant. You need to match exactly, which again is not what we want in a general search bar. E.g. I want to be able to go to the "Books" page and straight up search "enad bliton" (notice the typos) and I should get all books authored by "Enid Blyton".
from typesense.
Related Issues (20)
- [Feature Request] Filter Caching
- wrong facet_counts, missing facet values with Semantic Search HOT 5
- Typesense uses host machine memory stats when running in Docker
- Memory Corruption in `fuzzy_search_fields`
- [Feature request] Add "cleanup" parameter to snapshot operation
- [BUG] Lazy filter performance issue when more than 10 terms in a filter_by field HOT 1
- Voice Query - Whisper
- why so many open file descriptors to the same file? HOT 2
- cf/mistral/mistral-7b-instruct-v0.1 is only accepted Cloudflare Workers AI model
- [Feature Request] Streaming Conversational Responses
- Hightlight stop working when perform infix search with fallback operation
- Error when using buckets on vector search "Could not find a field named `_vector_distance` in the schema for sorting."
- [Feature Request] Conversational Search (RAG) with a local LLM HOT 7
- TypeSense: sorting only applies on the first page, How to fix that? HOT 1
- Hidden Hits Parameter Not Working in Multi-Search Vector Query
- Curation overrides causing duplicate results HOT 2
- Question/Feature Request: Pinned/Forced Search Results at Specific Positions HOT 5
- Parent of nested object array is the array of object itself and not the parent object
- add a sortable field
- Requesting support for Scandinavian letters (ä, ö, æ, ø, å) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typesense.