Problem/Motivation

The currently existing functionality implements "Did you mean". The views plugin to select for it is named "Spellcheck".

Proposed resolution

I suggest to consistently rename the existing functionality to "Did you mean" throughout the project files.

Remaining tasks

  • After that we should a second Views plugin that offers a "Spellcheck" in way that offers multiple suggestions to user instead a single "Did you mean" suggestion.
  • Update the documentation and add this link to this project's homepage on d.o.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mkalkbrenner created an issue. See original summary.

mkalkbrenner’s picture

Title: distinguish "Did you mean" and "Spellcheck" » distinguish between "Did you mean" and "Spellcheck"
tim-diels’s picture

Status: Active » Needs review
FileSize
79.74 KB
12.04 KB

Found some time to work on this issue and with some suggestions of @mkalkbrenner I came up with the patch attached.

suggestions

borisson_’s picture

Status: Needs review » Needs work

I only found some nitpicks but haven't tested this manually at all.

  1. +++ b/README.txt
    @@ -3,9 +3,14 @@ README.txt
    -Edit your Views search page and add the Spellcheck field to the Views' Header and/or Footer.
    +Edit your Views search page and add the Did You Mean or Suggestions Spellcheck field to the Views' Header and/or Footer.
    

    I think the 80 cols rule also goes for readme files. So we should probably rewrap this under 80 cols wide.

  2. +++ b/src/Plugin/views/area/SuggestionsSpellCheck.php
    @@ -0,0 +1,254 @@
    +  private $currentQuery;
    

    This should be protected instead of private, so that others extending this class can easily change this.

  3. +++ b/src/Plugin/views/area/SuggestionsSpellCheck.php
    @@ -0,0 +1,254 @@
    +    // Basically, work you way from the rightmost digit of the "odometer"...
    

    /s/you/your/

tim-diels’s picture

Status: Needs work » Needs review
FileSize
1.78 KB
12.16 KB

Solved the remarks.

borisson_’s picture

This looks good, I have not manually tested this and am not confident enough about the codebase to rtbc without testing, but the patch gets a +1.

mpp’s picture

Issue summary: View changes

How to use
----------

Edit your Views search page and add the Did You Mean or Suggestions Spellcheck field to the Views' Header and/or Footer.

@tim-diels, would you care to add this to the documentation once this gets in?


The patch looks good, thanks! Feel free to fix or ignore this tiny nitpick:

+++ b/src/Plugin/views/area/SuggestionsSpellCheck.php
@@ -0,0 +1,254 @@
+    if ($this->options['search_api_spellcheck_hide_on_result'] == FALSE || ($this->options['search_api_spellcheck_hide_on_result'] && $empty)) {

+++ b/src/Plugin/views/area/SuggestionsSpellCheck.php
@@ -0,0 +1,254 @@
+      if ($i == 0) {

== => ===

tim-diels’s picture

FileSize
12.16 KB
1.22 KB

@mpp I'm sure willing to add that to the documentation once it gets committed.

I changed the 2 == to ===

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

RTBC based on the feedback by @mpp and my own review earlier.

mpp’s picture

Issue summary: View changes

Great!

dksdev01’s picture

Any update on 8.x release branch?

mkalkbrenner’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.