How to check if string contains value in EpiFind?

1.1k Views Asked by At

I want to check if indexed string (my case string is "1,2,3") contains some value (like an actual string.Contains method), but it seems like EpiFind doesn't supply method for that.

I applied value.AnyWordBeginsWith(match) and it seems to work in my case but it's a hacky solution and might fail

searchQuery.Filter(x => x.StringToCheck.AnyWordBeginsWith("2"));

Is there a proper way to check if string contains my value?

Like this:

searchQuery.Filter(x => x.StringToCheck.Contains("2"));

Please note that this question is not related to ordinary string comparison in C# or LINQ before flagging the question.

1

There are 1 best solutions below

10
On BEST ANSWER

You should probably opt to index that value as a string array instead. It will simplify searching/filtering.

To do that, simply add a helper property like...

// Helper property used for indexing
public string[] ArrayOfStringToCheck => return StringToCheck?.Split(',');

...and then reindex your content. After that you can filter like:

searchQuery.Filter(x => x.ArrayOfStringToCheck.Match("stringToFind"));