title: LINQ select column that contains some array element
body: <p>I have a field &quot;details&quot; varchar(MAX) in my table with the detailed description of an item, I need to select the records that contain the keywords passed by the user in a string array.</p>
  <pre><code>var searchTerms = new List&lt;string&gt; { &quot;car&quot;, &quot;black&quot;, &quot;bike&quot;, &quot;blue&quot; };
  </code></pre>
  <p>I tried to do it like this:</p>
  <pre><code>var result = (from i in _contexto.itens
  where searchTerms.Any(d =&gt; i.details.Contains(d))
  select i.id);
  </code></pre>
  <p>and I get the following error:</p>
  <p>The LINQ expression 'DbSet()
  .Where(i =&gt; __searchTerms_0
  .Any(d =&gt; i.details.Contains(d)))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See <a href="https://go.microsoft.com/fwlink/?linkid=2101038" rel="nofollow noreferrer">https://go.microsoft.com/fwlink/?linkid=2101038</a> for more information.</p>
  <p>I also tried <a href="https://stackoverflow.com/questions/27295702/how-do-you-check-if-a-string-contains-any-strings-from-a-list-in-entity-framewor">this link's approach</a> using the &quot;SearchExtensions nuget package&quot; and the same error occurs.</p>
  <p>How can I do this? or should I make a query for each item in the array?</p>
  <p>Example of a text I want to search for:</p>
  <blockquote>
  <p>It is a long established fact that a <strong>car</strong> will be distracted by the
  readable  content of a page when looking at its <strong>bike</strong>. The point of
  using Lorem Ipsum  is that it has a more-or-less normal distribution</p>
  </blockquote>
  <p>Thanks!</p>