Not all fields from the index config make it to the index.

I currently only have a test to prove this theory. I have no idea what is actually going on. Some facet tests use "keywords" as a field, and that doesn't make it to index. When I run ::getFields on the index I don't see the keywords field, so there don't seem to be any keywords and I can't get them to pass. Weirdly enough this doesn't seem to happen all the time.

The testcase here does seem to prove that the fields are not all the same.

This might be because of missing dependencies - but if that's the case, we should clearly state those dependencies in the `search_api_test_db` module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

borisson_ created an issue. See original summary.

borisson_’s picture

Status: Active » Needs review
FileSize
1.58 KB

Status: Needs review » Needs work

The last submitted patch, 2: not_all_fields_from_the-2839142-2.patch, failed testing.

borisson_’s picture

Issue summary: View changes
borisson_’s picture

Status: Needs work » Needs review
FileSize
714 bytes
1.71 KB

More explicit assertion in the test.

Status: Needs review » Needs work

The last submitted patch, 5: not_all_fields_from_the-2839142-5.patch, failed testing.

borisson_’s picture

Status: Needs work » Needs review
FileSize
1.6 KB
2.19 KB

Status: Needs review » Needs work

The last submitted patch, 7: not_all_fields_from_the-2839142-7.patch, failed testing.

borisson_’s picture

The patch in #7 fixes the problem that we're testing for, but because it's a sledgehammer-type solution it breaks other tests.

Trying to figure out how to actually fix the underlying problem. I think this is a very valuable test though.

borisson_’s picture

Status: Needs work » Needs review
FileSize
1.38 KB
3.09 KB

I have no idea how to fix this.

Status: Needs review » Needs work

The last submitted patch, 10: not_all_fields_from_the-2839142-10.patch, failed testing.

drunken monkey’s picture

I think that's the same problem that forced us to add \Drupal\Tests\search_api\Functional\ViewsTest::installDrupal() (see lines 855–865 and #2612104-22: Cascade properly when processors providing new properties are disabled): we add the "Keywords" field for the "article" and "item" bundles, but those don't exist by default so we need to hack pretty deep into the test setup to enable them early enough.

Not actually sure why we don't just add the fields for the default (entity_test_mulrev_changed) bundle instead/additionally, though? Probably because the fix was relatively easy back then and just got vastly inflated by the move to BrowserTestBase.

borisson_’s picture

Status: Needs work » Needs review
FileSize
3.5 KB
6.59 KB

Fixes the test, thanks so much for helping out @drunken monkey , this makes so much more sense now that I more or less understand what's going on.

Actually, couldn't we remove them from our own bundles now? They should get them from the default bundle, no? Trying that now.

borisson_’s picture

Actually, couldn't we remove them from our own bundles now? They should get them from the default bundle, no? Trying that now.

Looks like that doesn't work. The test doess pass though, this should avoid confusion for anyone who adds a new test and should increase the sturdiness for anyone useing this example content.

drunken monkey’s picture

Component: General code » Tests
FileSize
10.56 KB
14.54 KB

Good to hear this worked, thanks!
However, more interesting would be to see whether that also fixes the ViewsTest without the installDrupal() override.
If so, we also don't need the new test, since ViewsTest would cover this anyways.

Removing the fields from the other two bundles can't work since we're creating articles/items in the tests with these fields – if those bundles don't have these fields, this can't work.

Also, removing the unrelated Index changes.

Status: Needs review » Needs work

The last submitted patch, 15: 2839142-15--test_index_setup.patch, failed testing.

borisson_’s picture

Look like that doesn't work, I do like this as it makes my tests easier, with this patch (#13) applied, I can make my own tests easier #2839629: Remove ::installModulesFromClassProperty from test.

drunken monkey’s picture

Status: Needs work » Needs review

Hm, weird. Unfortunately, debugging doesn't seem to work for me anymore since the move to BTB tests, so this'll have to wait.
Anyways, should we just commit the additional test field config files? And would you then say we should also add the new test, just to be safe?

borisson_’s picture

The additional config files make sense yeah. I'd say the new test makes sense as well. Even though it might test something that's implicitly tested somewhere else I don't really mind that tbh.

drunken monkey’s picture

Status: Needs review » Fixed

OK, then let's do that.
Committed #15 minus the ViewsTest changes.
Thanks again!

Status: Fixed » Closed (fixed)

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