Setup

  • Solr version:8.6
  • Drupal Core version: 10.1
  • Search API version: 8.x-1.31
  • Search API Solr version: 4.31
  • Configured Solr Connector: Standard

Issue

Im trying to use EdgeNGramFilterFactory with the preserveOriginal option, which works fine should I manually include preserveOriginal="true" in my schema_extra_types.xml, however the issue is that when I try and get this into Drupal config, the "true" is being converted to "1".

          class: solr.EdgeNGramFilterFactory
          preserveOriginal: 1
          minGramSize: 4
          maxGramSize: 25
    -

So the next time the config set is pulled down the required "true" will now be "1" and this option ceases to function properly (IE, in the above example a string with 3 letters is ignored). Id have thought 1/true would be considered the same, but that doesn't seem to be the case in my testing.

1 = doesn't work as expected
true = does work as expected

Im going to get around this by hooking into the event that builds the config set, and manually overriding it but that feels pretty nasty.

Am I doing something wrong?

CommentFileSizeAuthor
#10 3415609.patch3.21 KBredwan jamous
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

aaron.ferris created an issue. See original summary.

aaron.ferris’s picture

Issue summary: View changes
aaron.ferris’s picture

Issue summary: View changes
mkalkbrenner’s picture

I wonder if we have a bug in our config schema.

aaron.ferris’s picture

Yes possibly, seems like something similar has been seen before but with ASCIIFoldingFilter

  preserveOriginal:
        # @todo ASCIIFoldingFilter expects a boolean
mkalkbrenner’s picture

Yes, it seems like an inconsistency of Solr. Fixing that todo will solve the issue for EdgeNGramFilterFactory, too.

mkalkbrenner’s picture

I guess it will affect NGramFilterFactory as well.

What we basically need to do is:

  1. Add the preserveOriginal option to the NGram field types using Solr's default
  2. Add an update hook
  3. Provide a setting based on filter/property combinations with different types
  4. Add a switch to the config generator to convert preserveOriginal into a boolean on the fly based on the setting above

redwan jamous made their first commit to this issue’s fork.

redwan jamous’s picture

Status: Active » Needs work
StatusFileSize
new3.21 KB

I created a MR that changes the value of preserveOriginal to boolean for the following filters:

  1. solr.ASCIIFoldingFilterFactory
  2. solr.EdgeNGramFilterFactory
  3. solr.NGramFilterFactory

This MR is just a starting point, I would appreciate any comments or further guidance.

Attaching a static patch file to use with composer...

sujal kshatri’s picture

.

mkalkbrenner’s picture

Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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