Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Reproduction:
- Install database search defaults
- Create rest export view based on default index, provide rest export
- Set format to facets serializer
- Save view
- Create a facet based on the rest export view
- Select array with raw results format
- Go to view url and see "client error"
From log:
Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException: No route found for the specified format html. in Drupal\Core\Routing\RequestFormatRouteFilter->filter() (line 51 of
/app/web/core/lib/Drupal/Core/Routing/RequestFormatRouteFilter.php).
This error is also thrown on the views listing page. Sometimes the view breaks and becomes ineditable.
Comment | File | Size | Author |
---|---|---|---|
#8 | facets-rest_view_broken-2939871-8-D8.patch | 1.1 KB | drasgardian |
#6 | Screenshot from 2018-02-18 10-53-45.png | 101.57 KB | mortona2k |
Comments
Comment #2
borisson_I think this is expected behavior now, you should add the format to your request:
/search/rest?_format=json
Comment #3
borisson_Comment #4
mortona2k CreditAttribution: mortona2k commentedI can get output with the format parameter. How do I set the facet value in the request?
The last line in my report says the views ui is broken. I literally can't access the list of views after creating one with a rest facet display. I also can't edit the view after saving it.
I really appreciate you getting back to me. I'd really like to get this working for a project, and am willing to put in time to debug and improve.
Maybe it's just something I'm doing wrong in the order of creating the view and facet, or some facet config mistake?
Comment #5
borisson_The facets that are passed out from the output, should contain a link to filter by them.
That is really weird, I can't reproduce this behavior at all. Can you reproduce this on a clean drupal install?
Comment #6
mortona2k CreditAttribution: mortona2k commentedI'm trying this on a fresh drupal install after a composer update.
I installed search_api_db_defaults, realistic_dummy_content, and facets_rest. Then created some dummy content.
This time, I created the rest export view and saved it, then created the facet. Everything was ok at this point.
Then I changed the view plugin to facets serializer and saved, that's when the view and view listing breaks and says "A client error happened."
Here's my view config:
Comment #7
mortona2k CreditAttribution: mortona2k commentedHere's a simplytest site that's set up as I described (without the dummy content):
https://dps6.ply.st/admin/structure/views/view/rest_facets/edit/rest_exp...
Login is admin:admin.
If you click on the second view display configured with facets serializer, it will crash. Also if you go to the views list.
To undo the broken display, delete it here:
https://dps6.ply.st/admin/structure/views/nojs/reorder-displays/rest_fac...
Maybe there's just some obvious config error I'm making, I'd really appreciate it if you could show me a basic setup that works in that site.
Comment #8
drasgardian CreditAttribution: drasgardian at Eighty Options commentedThe attached patch cleared this error up for me.
removing the defineOptions() function fixed the "client error" errors, and allowed the requested formats (csv, json, xml) views config to be saved.
The second part of the patch got the views results correctly formatted.
Comment #10
borisson_Wait, huh? How is this supposed to still return the facets? Does this not remove the facets from the rest output?
The tests seem to agree with that.
Comment #11
drasgardian CreditAttribution: drasgardian at Eighty Options commentedSorry, maybe I misunderstood what the expected output is here. I was aiming for a csv output respecting the same facet filters as my page display, which worked quite well.
Comment #12
borisson_@drasgardian: the expected output is to have the facets, as well as the search api results in the output. Your issue is an interesting one - that should be a new feature request.
Comment #13
borisson_That sounds like a really good idea, I created #2956898: Add an option to the rest export to not show the facets in the export. to do that, I think that means we can close this issue, and remove the ::defineOptions when we actually add tests for csv and/or xml?
Comment #14
borisson_I'm closing this, because it went in different directions, and there is a patch that resolves the problem in #11 in #2956898: Add an option to the rest export to not show the facets in the export..