-
Notifications
You must be signed in to change notification settings - Fork 420
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
Incorrect results returned from search query when logged-in #2589
Comments
I think the issue here is that searches as logged-in users aren't finding all the annotations they should find. Here's a gist showing the results of identical queries to the search endpoint when logged-out vs logged-in (on stage). The logged-in query shows fewer annotations, which can't possibly be correct. Bizarrely, removing the Either way, the invariant is this: a logged-in query should always return the same annotations or more annotations than a logged-out query. I'll look into this a bit later on today. |
I wonder if these are pre-groups annotations that have no group field? I'll look into this anyway |
Ahhh, that might explain it. I might've been confused by the fact that they get rewritten on the way out. |
And that would explain why it works when you're logged out -- the groups feature is toggled off so the |
Oh, actually now that I look my server-side code to insert |
Yep, I can reproduce this locally:
|
Possible solutions:
|
My vote is for 4 |
Yep. 4. That requires changing only |
And doing an Es migration. Ok, I'll do that after lunch then |
My point was that if you change |
When creating or updating an annotation if the annotation has no 'group' field then insert 'group': '__world__'. This fixes a bug where people calling our API directly can create annotations with no group field, then for example when the sidebar searches for annotations with 'group': '__world__' it won't find these annotations, but the Chrome extension badge (which doesn't put any group filter in its searches) will find them. This could be fixed client-side but it's better to make the annotations in our search index consistent, than to try and always remember that public annotations may either have group: '__world__' or no group at all. This means that it's no longer necessary for us to insert group: '__world__' on the way out in render(). Annotations pre-dating this commit with no group can be migrated with: hypothesis annotool conf/production.ini prepare Fixes #2589.
When creating or updating an annotation if the annotation has no 'group' field then insert 'group': '__world__'. This fixes a bug where people calling our API directly can create annotations with no group field, then for example when the sidebar searches for annotations with 'group': '__world__' it won't find these annotations, but the Chrome extension badge (which doesn't put any group filter in its searches) will find them. This could be fixed client-side but it's better to make the annotations in our search index consistent, than to try and always remember that public annotations may either have group: '__world__' or no group at all. This means that it's no longer necessary for us to insert group: '__world__' on the way out in render(). Annotations pre-dating this commit with no group can be migrated with: hypothesis annotool conf/production.ini prepare Fixes #2589.
When creating or updating an annotation if the annotation has no 'group' field then insert 'group': '__world__'. This fixes a bug where people calling our API directly can create annotations with no group field, then for example when the sidebar searches for annotations with 'group': '__world__' it won't find these annotations, but the Chrome extension badge (which doesn't put any group filter in its searches) will find them. This could be fixed client-side but it's better to make the annotations in our search index consistent, than to try and always remember that public annotations may either have group: '__world__' or no group at all. This means that it's no longer necessary for us to insert group: '__world__' on the way out in render(). Annotations pre-dating this commit with no group can be migrated with: hypothesis annotool conf/production.ini prepare Fixes #2589.
I confirm this fixed on stage. |
blog.jonudell.net has 5 annotations with these group properties:
I'm logged into 0.7.5.70 (g562d537.dirty), it reports 5 as I reckon it should because I'm a member of MEpy2d.
Badge query: GET /api/search?limit=0&uri=http://blog.jonudell.net/
Result: {"rows": [], "total": 5}
But no annotations anchor because the extension makes this query:
https://stage.hypothes.is/api/search?group=__world__&limit=200&offset=0&order=asc&sort=created&uri=http:%2F%2Fblog.jonudell.net%2F
And gets no results: {"rows": [], "total": 0}
The text was updated successfully, but these errors were encountered: