Home > Software engineering >  Filter string match without regex
Filter string match without regex

Time:02-27

I want to filter a column with type string in a a collection result with Like here the logic :

so my logic I want to display all matches when the char before and after my search word in the sentence is in any of my delimiters, if not i don't display the row.

CodePudding user response:

The thing you want is hard to impossible to do using like and string operations in database. And even when you get it right it will be slow. What you should do is use mysql feature full text search. And yes Entity Framework nor linq is supporting this syntax so you will have to circumvent the EF and write that query in a string.

_supplierDbContext.Database.SqlQuery<DTO>(
      "select something from table match (column) against (:keywords)",
      new SqlParameter(":keywords",keywords))
  • Related