Needs review
Project:
Search API
Version:
7.x-1.x-dev
Component:
Views integration
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Nov 2014 at 16:49 UTC
Updated:
14 Jan 2019 at 00:21 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sgdev commentedAdding issue as a cross-reference.
Comment #2
drunken monkeyThat's already possible by just setting the exposed filter to be "Required". Missing is only the ability to customize the message then – if someone provides a patch for that (if it's something that's easy to override), I would be prepared to commit that.
Comment #3
sgdev commentedI understand it already exists if the field is set to required. I'm referring to the comment from Garrett Albright (https://www.drupal.org/node/2207187#comment-8595593):
The Search API Views Empty Query module avoids this problem. This is a much more acceptable user experience than having the field be displayed as an "error" for not having information included.
Comment #4
drunken monkeyYou're right, that makes sense. If the change would be light-weight enough, I'd probably commit such a patch. It should probably be restricted to the "Fulltext search" filter handler (or maybe also the query plugin, if necessary), not have a global settings form, etc.
In any case, I don't have the time to work on this myself, but I'd review a patch.
Comment #5
sgdev commentedThanks for your feedback. I've posted a message to the Search Views Empty Query issue queue asking them to consider converting the module into a Search API patch: https://www.drupal.org/node/2405255
Comment #6
legolasboThis issue has not seen activity in over 2,5 years. I am therefore closing this issue to clean up the issue queue. Feel free to re-open and update this issue if you feel this issue is still relevant and of importance.
Comment #7
sgdev commentedThis should really be added to Search API. It's a separate module and 150 lines of code: https://cgit.drupalcode.org/search_api_views_empty_query/tree/search_api...
The module owner said he would take a look at it 3 years ago (today!) and never did. Let me just post a patch for review.
Comment #8
sgdev commentedPlease review the attached patch. This includes everything currently available in the Search API Views Empty Query module, adds open patches in the issue queue (there are only two), and cleans up the code to use more standard processes.
The settings currently exist at a new menu item (
/admin/config/search/search_api_views). If you prefer this to be in another location such as a sub-menu of Search API, let me know. Thanks.Comment #9
sgdev commentedFYI, this currently includes a settings form, so if that's not wanted, I'd appreciate feedback. Thanks.
Comment #10
drunken monkeyDid you take a look at how we have solved this in Drupal 8? Just backporting the functionality there (see
\Drupal\search_api\Plugin\views\filter\SearchApiFulltext::validateExposed()) seems to be better than to introduce a completely different functionality in D7.Comment #11
sgdev commentedNo, I did not. We're not yet using D8.
Comment #12
sgdev commentedI understand it's been a while, we previously discussed just trying to port the existing module (https://www.drupal.org/project/search_api_views_empty_query) into Search API. Unfortunately the module owner never created a patch as he said he would do. So was just taking that approach.
Realized there was a bug in patch #8, so I had to roll a new version. I understand if your preference is to backport what exists in D8. If someone wants to pick it up from here they can do so.