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 7175495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:18:31+00:00 2026-05-28T16:18:31+00:00

I was wondering what the best approach would be to search a database via

  • 0

I was wondering what the best approach would be to search a database via multiple columns by using only 1 search box. Scenario below:

I want to be able to search Customers by inputting their details into a search box. This could be either their name, post code or id. I can also perform 1 search by using more than 1 search criteria. For example I could search by name and id (Bob Smith cus345).

A first approach I took was to split the search term, seperating each space into a seperate word but this has its down fall as a customer name may contain 3-4 words. This can lead to a tonne of conditional statements but this is inefficient so I was wondering if there was a better way of doing this.

I find this a difficult task to do because the user could search in any order (ie search by post code, then name and then id, or name and id and so forth)

  • 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. Editorial Team
    Editorial Team
    2026-05-28T16:18:32+00:00Added an answer on May 28, 2026 at 4:18 pm

    You could use regular expressions to detect specific terms like post codes but you are right in saying that either way you will end up with a load of conditions.

    I would highly recommend using Lucene.net. It is not difficult to implement but it provides ranked results by default, is lightning fast (faster than a stored proc would be against a multi-termed query) and will cater easily for the kind of search you are describing. You can also weight/bias certain fields, so a partial post code match has more weight than a first name match.

    With regards to splitting a search, I usually run a check for reserved characters like * and (, or even strip them out completely if I don’t want the user to be able to perform complex searches themselves. I then split upon word boundarys and perform a AND search.

    As far as I know there is also a Lucene to Linq provider too.

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

Sidebar

Related Questions

I am wondering what would be the best approach to store, for let's say
I've discovered this jsFiddle and I'm now wondering what the best approach would be
I was wondering how one would best approach the task of deciding upon the
I was wondering what would be the best approach towards finding the index of
I was wondering what the best approach would be to the following problem. Say
I am wondering what the best approach would be to check whether or not
I was wondering what the best approach would be to validate a date is
I was wondering what the best approach would be for the following situation: I
I was wondering what would be the best approach to split up array processing
I was wondering what would be the best approach to make a Grails app

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.