backdrop-contrib / search_api

Provides a generic API for modules offering search capabilities
GNU General Public License v2.0
0 stars 5 forks source link

Invalid option list<text> in fields element #46

Closed samgreco closed 7 months ago

samgreco commented 1 year ago

Whenever I try to "add related field" of a Vocabulary, I get:

Invalid option list<text> in fields element. Invalid option list<text> in fields element. Invalid option list<text> in fields element. Invalid option list<text> in fields element. Invalid option list<text> in fields element. Invalid option list<text> in fields element. Invalid option list<text> in fields element. Invalid option list<text> in fields element. Invalid option list<text> in fields element. Invalid option list<text> in fields element. Invalid option list<text> in fields element.

And get go any further. Can't undo, but it won't save anything. Any clues?

I am trying to recreate a faceted search product catalog that I have in D7-Ubercart so I can move the site to Backdrop.

argiepiano commented 1 year ago

Hi @samgreco. I'm unable to reproduce with a fresh intallation.

Can you check on the following:

argiepiano commented 1 year ago

One more thing: can you be more specific about where you are encountering this error? Please past the exact path, and post step-by-step directions to reproduce.

samgreco commented 1 year ago

Entity Plus is 1.x-1.0.18 Yes, This is a D7 Upgrade Yes, the vocabularies are showing, And I can manage fields, but yes, I am seeing the following when I go to Configure a field (not every time):

_Creating default object from empty value in view->init_display() (line 513 of /home/tbwdev/domains/asi-bd.tbwdev.com/public_html/core/modules/views/includes/view.inc_

I indeed do have all messages selected in logging

And actually, I just realized that I am getting the above error ( _Creating default object ) whenever I create an index and add ANY field. The original errors in my OP happen only when I do the following:\

I go to: admin/config/search/search_api/index/product_index/fields Click "Add related fields at the bottom Select ANY taxonomy field Click save

And I have completely deleted the index and started fresh and still get the same errors.

argiepiano commented 1 year ago

Thanks for the additional info. I'm unable to reproduce on clean install.

OK, let's try to reverse-engineer this first error. The second warning you posted "Creating default object..." is a Views error, and may or may not be related.

The first error "Invalid option" is produced by core when the selected values of a select field do not correspond with any of the valid options. In the "Select fields to index" page, do you see any specific field becoming "red" when this error is shown after saving? Which one?

Let's also try to the following:

  1. Install Devel
  2. Edit core/includes/form.inc starting on line 1397 to look as follows (NOTICE the added line after if(!isset..))
        if (is_array($elements['#value'])) {
          $value = in_array($elements['#type'], array('checkboxes', 'tableselect')) ? array_keys($elements['#value']) : $elements['#value'];
          foreach ($value as $v) {
            if (!isset($options[$v])) {
              dpm($v, 'value'); dpm($options, 'options'); dpm($elements['#parents'], 'parents'); // ADDED TO DEBUG. REMOVE LATER.
              form_error($elements, $t('Invalid option %choice in %name element.', array('%choice' => $v, '%name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'])));
              watchdog('form', 'Invalid option %choice in %name element.', array('%choice' => $v, '%name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']), WATCHDOG_ERROR);
            }
          }
        }

Then try to reproduce. You'll get some debug output for at least one of the fields that's producing this error. Please report back and past those values.

samgreco commented 1 year ago

No fields are red.

I have not seen any errors other than those above. Devel is showing me a broken view error, which I can't get rid of. I don't know that it has anything to do with the issue. But that page spins forever, occasionally giving me the wait or exit popup. So I don't know if the broken view is looping Devel, but not seeing any other errors.

I think I need to sort the view problem, to take that out of the equation.

Any idea how to delete a corrupted view when the UI won't let you remove or configure it?

argiepiano commented 1 year ago

@samgreco, Devel has some issues in BAckdrop that have not been solved. Whenever you do a dpm of a very complex or large array, the browser will get into very long loops that result in the browser giving you the wat or exit option. Instead of trying to output the whole array or object, you may want to do an dpm(array_keys($your_array)); or dig into the array to output what you need.

However, the debugging I suggested above should not cause this. Perhaps you tried debugging other stuff with dpm?

As for removing a View that's corrupted - it's very simple in Backdrop. Go to files/config_XXXX and delete the json file that contains the View. You may need to clear caches after doing that (for example using the bee command line, which is similar to Drupal's drush).

Did you get any output from the dpm's I suggested above?

samgreco commented 1 year ago

Thanks for your valiant efforts sop far. I still cannot get Devel to show anything. I still see the original errors I posted.

When I try to index what I have, I get:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=2532034&op=do_nojs&op=do StatusText: error ResponseText: Error: Call to undefined function entity_property_verbatim_get() in EntityStructureWrapper->getPropertyValue() (line 453 of /home/xxx/domains/xxx.com/public_html/modules/entity_plus/includes/entity_plus.wrapper.inc).

Nothing from Devel either way. I tried using a DB backend and Solr. Same issues.

And something is causing Devel to spin like crazy, eventually needing to exit the page to get anywhere. After a reload, I can usually work in that page without issue. Until I try again to add any additional fields.

samgreco commented 1 year ago

So it indexes fine with "normal" fields. As soon as I add a taxonomy, it fails with the HTTP 500 error. And this is my basic "Brands" vocabulary. It's flat, no hierarchy.

argiepiano commented 1 year ago

Error: Call to undefined function entity_property_verbatim_get() in EntityStructureWrapper->getPropertyValue()

Yup, that's a bug in search_api. I'll open an issue to fix that. This may actually be causing the other problems.

argiepiano commented 1 year ago

Can you please use #48 to patch your current version of search_api and see if that makes a difference?

BTW The Devel issue, as I explained above, is a problem with that particular module when outputting very large or complex arrays and objects. It's not related to the problem here.

samgreco commented 1 year ago

I was able to "add related field" of the one "flat" taxonomy (no hierarchies) and then index. But when I went to add the second taxonomy, which is our product category vocabulary (sometimes 4 levels deep of hierarchy), I get the original messages, the Invalid option list&lt;text&gt; in fields element., etc.

argiepiano commented 1 year ago

Well, that's some progress. So, the dpms I suggested above don't produce any output when you get those "Invalid options"? Or did you remove them because they do that infinite looping thing?

I'm going to try again to reproduce this today by starting with a D7 site. Can you tell me a bit about your vocabularies and node structures (including any reference fields etc). It may be helpful if you pasted photos of your "manage field" screen for your content type, and perhaps a portion of your "list term" screens for your vocabularies.

samgreco commented 1 year ago

Sorry. It's been a busy day.

I have the original line of dpms in at the moment. No Devel output.

First vocabulary is the Catalog categories. There are a lot. And they are nested as far as 4 deep sometimes. There are 12 top level categories. Catalog terms

Then the Brands, which is always just one level. Brands terms

Both have image fields.

Ubercart product nodes, with additional fields and using the Price Per Role module to create dealer prices for wholesale. Product Fields

Hope this helps. If you want to see the D7 site that this is coming from: https://www.audiosupply.com Go to the Shop page to see the faceted search catalog. That's what I am trying to recreate.

Thanks

samgreco commented 1 year ago

Also, I didn't do this one: dpm(array_keys($your_array)); since I am not sure what array would be correct for ($your_array)

samgreco commented 11 months ago

Just to follow up: I was on vacation for the last 2 weeks. When I returned, I updated the site to BD 1.25 and a a couple of other modules. Now it all seems to be working. I have to get the views and facets setup to test. But no more errors adding the fields, etc.

Thanks for the assist.

laryn commented 7 months ago

Now it all seems to be working.

Closing as completed. Thanks @argiepiano for the support and @samgreco for filing and following up in the issue!