-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested search backend #9
Comments
I have some nested objects in my models that I'd like to search on. I see the The rough by-hand approach that I had been working toward was to implement graphene types for nested objects, including search, etc. I hadn't gotten to the point of resolving the queries, though. |
Sure, I have a sketch. This whole project is designed after django-elasticsearch-dsl-drf. See the link for getting an impression what could you expect from Thus, still a little bit vague and unclear as I'm not yet certain on the implementation details or feature release dates. |
Thanks, @barseghyanartur. That helps quite a bit to know the functionality you are aiming to achieve. I'll try to digest that a bit. |
Hi, @barseghyanartur . I am trying to work on this feature. But i'm not certain how a nested search query should display in GraphQL. Have you got any idea about this? allPostDocuments(
search: {
tag: 'Python' # a simple field
comments: { # a nested field
query: 'Python', # query on configured fields
# tag: 'Python' # search on a single field
}
}
){
tag
category
comments{
author
tag
}
} or allPostDocuments(
search: {
tag: 'Python' # a simple field
}
nestedSearch: {
comments: { # a nested field
query: 'Python', # query on configured fields
# tag: 'Python'
}
}
){
tag
category
comments{
author
tag
}
} |
The first approach looks cleaner, although might be a little bit more difficult to implement, but I think we should aim for that (the first option). However, if it does not work out (or hard to implement in a generic way), we should fall back to the second option (which would be easy-peasy). |
P. S. I've merged your another PR into the master, but there are some issues with tests due to merging. I'm solving it later on today. I think tomorrow we'll have master all clean and working so that you could branch from that. |
okay. |
Master is updated. Changes released as 0.7. |
Thanks for reminding. And I see the current config format of search_fields like below. search_fields = {
'title': {'boost': 4, 'field': 'title.raw'},
'content': {'boost': 2},
'category': None,
} It's inconvenient to set (when i have many fields but only one field need # Type 3
search_fields = [
{
'field': 'title',
'boost': 2
},
'content',
'category',
'description',
'summary'
] Although we may need a extra filter to find related option instead of Suggestions are welcomed. |
Let's leave the current config format intact. It's just the way it is. |
Okay |
What is the sample query for Nested Search ? I am using version 0.8 of this library and have configured search_nested_fields .But when I query the nested data is coming as null. Please advise. class person(Document): query is " getting this error : search_phase_execution_exception', 'failed to create query: [nested] failed to find nested object under path [address] |
WIP in branch nested-search-backends.
The text was updated successfully, but these errors were encountered: