Pattern matching in filters?

Pattern matching in filters?

PixelAzulPixelAzul Posts: 2Questions: 1Answers: 0

We have a number of items in our data that have the greek character α (alpha) as part of the text. We'd like people who search for the word "alpha" to see results that contain "α". Is there a way to do that?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    You'd need to create a search plug-in that did the substitutions you need.

    Allan

  • PixelAzulPixelAzul Posts: 2Questions: 1Answers: 0
    edited February 2023

    Thanks Allan. What I don't quite get is that search plugins seem to work on the filtered data the function is handed. So if there are 5 rows and two contain a "P" and I type "P" in the search, the search plugin iterates through those two rows and can further evaluate them. Since I want to include a row that would otherwise be excluded (one containing an "α"), it feels like the plugin doesn't ever get called for that row. (Edit: will keep working with a couple of samples, like the accent neutralizer, that may provide helpful hints)

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Hmmm - yes, sorry. The built in filtering runs first, and then the plug-in filters after that, allowing them to do cumulative filtering. The result would be that by the time that the plug-in runs, a row with α would already have been removed!

    I think you are right - a type based plug-in would be the way to go here. Here is a simple example with just the α character. It allows a search for alpha to match either form, but searching for α will only match that character. An inverse replace would resolve that (although watch out for recursion!).

    If you write up a full plug-in, I'm sure others would be interested as well if you'd be willing to share it :)

    Allan

Sign In or Register to comment.