Whenever I try to save a filter with alpha12, I get the following error. I tried to forcing the unsetting of min/max always and never in SearchApiFilterTrait->valueForm() but got nowhere.

Thanks for any assistance.

InvalidArgumentException: The configuration property display.default.display_options.filters.title.value.min doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 79 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters.title.value.min', '')
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters.title.value', Array)
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters.title', Array)
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters', Array)
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options', Array)
Drupal\Core\Config\StorableConfigBase->castValue('display.default', Array)
Drupal\Core\Config\StorableConfigBase->castValue('display', Array)
Drupal\Core\Config\Config->save()
Drupal\Core\Config\Entity\ConfigEntityStorage->doSave('search', Object)
Drupal\Core\Entity\EntityStorageBase->save(Object)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object)
Drupal\Core\Entity\Entity->save()
Drupal\Core\Config\Entity\ConfigEntityBase->save()
Drupal\views_ui\ViewUI->save()
Drupal\views_ui\ViewEditForm->save(Array, Object)
call_user_func_array(Array, Array)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object)
Drupal\Core\Form\FormBuilder->processForm('view_edit_form', Array, Object)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'edit', Array)
Drupal\views_ui\Controller\ViewsUIController->edit(Object, NULL)
call_user_func_array(Array, Array)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1)
Stack\StackedHttpKernel->handle(Object, 1, 1)
Drupal\Core\DrupalKernel->handle(Object)

This happens on search_api_db and search_api_solr and apparently isolated to fulltext. Incidentially, I do not have the option to choose Fulltext under the Filter options, even though some are defined under General and the bundle itself.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

grahl created an issue. See original summary.

grahl’s picture

Issue summary: View changes
grahl’s picture

Status: Active » Closed (outdated)

No longer an issue with 1.x-dev

grahl’s picture

Title: Cannot use filters on index » Cannot use date filters on index
Version: 8.x-1.0-alpha12 » 8.x-1.x-dev
Status: Closed (outdated) » Active
FileSize
765 bytes

Sadly, I have to reopen this issue due to a remaining issue with the date field:

Call to undefined method Drupal\\search_api\\Plugin\\views\\query\\SearchApiQuery::addWhereExpression() in views/src/Plugin/views/filter/Date.php on line 188,

Apparently, without providing opSimple() Views adds a where expression directly. I copied the relevant portion over. Now my query executes but does not actually add the condition as expected but I'm unsure where the issue lies (see attached patch). This is complicated by an issue with value.min, which I file separately in a moment.

drunken monkey’s picture

Status: Active » Needs review
FileSize
1.36 KB

Ah, you're right, this really doesn't seem to work. Apparently I forgot to test that one while implementing Views filters. Thanks a lot for reporting this, and analyzing it already quite thoroughly!

Your patch also already goes into the right direction, I just adapted it a bit to hopefully arrive at something that will work for all cases, and also solve the exceptions when trying to save the view. Please test/review!

Also, ideal would of course be if we also had a test case for this functionality, to ensure it doesn't break again. Would you be willing to add such a test to our existing ViewsTest::testView() method?

grahl’s picture

Thanks so much for your help! :-)

Patch works great with one minor change (value should have been set for offset from $this-value['value'] not $value).

I'll try to provide a test case and hand it back otherwise directly.

drunken monkey’s picture

Ah, you're right, thanks for catching that!
Yes, a test would be great. Otherwise, please just report back here.

borisson_’s picture

drunken monkey’s picture

Status: Needs review » Needs work

The comment needed to rewrapped.

The comment needs to be removed, not rewrapped, it makes no sense at all in our case. Seems we just copied that as-is from Views' SQL query plugin.

borisson_’s picture

Removed the comment.

drunken monkey’s picture

Thanks!

@ grahl: Are you still working on this? Any chance to add a test?

grahl’s picture

Sorry, I got swamped with other issues. I'll attempt to provide the test by Wednesday evening or hand it back.

grahl’s picture

Sorry, I couldn't provide a meaningful test setup in time.

drunken monkey’s picture

I hate Views so much …
But here are the tests, hopefully all working. Also created #2704077: Exposed operator for Views date filters doesn't accept "(not) empty" for a Views issue I encountered. (But worked around it here, of course.)

Status: Needs review » Needs work

The last submitted patch, 14: 2664286-14--views_date_filter.patch, failed testing.

The last submitted patch, 14: 2664286-14--views_date_filter.patch, failed testing.

drunken monkey’s picture

Status: Needs review » Needs work

The last submitted patch, 17: 2664286-17--views_date_filter.patch, failed testing.

borisson_’s picture

Code and test look great, the earlier fail was a random fail, see #2709899: php7 + postgres throws AlreadyInstalledException randomly.

borisson_’s picture

Status: Needs work » Reviewed & tested by the community

  • drunken monkey committed 5657d58 on 8.x-1.x
    Issue #2664286 by drunken monkey, grahl, borisson_: Fixed Views date...
drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Good to hear, thanks for testing!
Committed.
Thanks again, everyone!

Status: Fixed » Closed (fixed)

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

sagesolutions’s picture

I've ran into this issue using Drupal 8.2.4 and Search API 8.x-1.0-beta4 and search_api_solr 8.x-1.0-beta1

I created an issue at https://www.drupal.org/node/2841644, but now that I have found this issue, I think its the same thing and still happening for me.

magtak’s picture

I've ran into this issue using Drupal 8.2.5 and Search API 8.x-1.0-beta4

Steps to reproduce:

1) install Drupal 8.2.5
2) install search_api 8.x-1.0-beta4
3) install devel_generate and generate some content (e.g. 50 articles)
4) add a new search_api DB server - default settings
5) add a search_api index - default settings
6) add the fields to the index: title, and a date field (e.g. "Authored on") (*)
7) index your content
8) create a view for that index (the type of the view should be "index $yourIndexName")
9) add a filter for Authored on (e.g. is equal to "today" - offset)
10) try to save the view
(*) initially we thought only user-created datetime fields will cause this but core fields do so as well

Step 3 might even be optional

anavarre’s picture