Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 145697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:28:11+00:00 2026-05-11T08:28:11+00:00

For a website I’m doing we’re using LINQ to Entities. I have been charged

  • 0

For a website I’m doing we’re using LINQ to Entities. I have been charged with adding search functionality to the site. I’m trying to figure out the most elegant way to search for multiple keywords (user entered) on a single field in the database. Allow me to give an example.

Table columns:

Name, Description 

Example row:

'Cookie monster', 'Fluffy, likes cookies and blue' 

User search (delimiter doesn’t matter):

'blue fluffy'  

Currently I am using the following:

    public List<SesameCharacters> SearchByKeywords(string keywords)     {         List<SesameCharacters> output = new List<SesameCharacters>();         string[] k = keywords.ToLower().Split(' ');         using (SesameStreet_Entities entities = new SesameStreet_Entities())         {             IQueryable<SesameCharacters> filter = entities.SesameCharacters;              foreach (string keyword in k)                 filter = ForceFilter(filter, keyword);              output = filter.ToList();         }         return output;     }      private IQueryable<SesameCharacters> ForceFilter(IQueryable<SesameCharacters> filter, string keyword)     {         return filter.Where(p => p.Description.ToLower().Contains(keyword));     } 

This currently works as expected but I imagine it is not the best solution to the problem. Am I missing something glaringly obvious?

NOTE: This is AND matching.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:28:11+00:00Added an answer on May 11, 2026 at 8:28 am

    Looks like Linq to Entities doesn’t support contains:

    http://msdn.microsoft.com/en-us/library/bb738638.aspx

    I’d roll my own query for this one. Your probably going to want full control over the text search queries if you find out these types of searches become performance issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My website is in the root directory, which is /www.lebmotor.com/web/content/ . I am using
My website is set to UTF-8, do i have to set my forms also
My website structure has a root /index.php, some files as /directory/index.php and some as
Our website sends e-mails to the e-mail address which a user enters on our
My website has a large number of readers every day. I wanted to track
My website allows uploading of images. I limit images to 10 megapixel or less
My website consists of two frames, let's say upperFrame and lowerFrame. On the document
My website's root page automatically redirects all users to some subpage via http header.
A website I work on is currently running three different instances of Wordpress blogs,
The website I am developing uses jQuery UI tabs to load content via AJAX

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.