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

  • SEARCH
  • Home
  • 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 3217782
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:27:05+00:00 2026-05-17T15:27:05+00:00

I have a basic datatable, it can be completely generic for this example, except

  • 0

I have a basic datatable, it can be completely generic for this example, except for that it contains a Username column.

I’d like to have a simple textbox and a button that performs a similarity search on the Username field. I know I can use the .Contains() method and it will translate to LIKE in sql, but is this the correct way of doing this?

Secondly, suppose that I have another item in a many to many relationship that I also want to search, in this case Label.

Data
{
   ID,
   Name,
   ...
}

Many
{ 
  DataID,
  OtherID
}

Other
{
   ID,
   Label
}

I’d eventually like to find all of the Data items with a Label similar to some search clause. Do I again just use .Contains?

I’d then like to sort to get the best matches for Username and Label in the same query; how can the combined likeness of {Username and Label} be sorted?

Edit: How are a LIKE query’s results sorted? It is simply based on the index, and a binary it matches vs it does not match? I guess I’m not that concerned with a similarity score per say, I was more or less just wondering about the mechanism. It seems as though its pretty easy to return LIKE queries, but I’ve always thought that LIKE was a poor choice because it doesn’t use indexes in the db. Is this true, if so does it matter?

  • 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-17T15:27:05+00:00Added an answer on May 17, 2026 at 3:27 pm

    String similarity isn’t something SQL can do well. Your best bet may be to find all the matches with the same first two (or three if necessary) characters and then, assuming this is a manageable number, compute the similarity score client-side using the Levenshtein distance or similar (see http://en.wikipedia.org/wiki/Levenshtein_distance).

    Or if you are feeling brave you could try something like this! http://anastasiosyal.com/archive/2009/01/11/18.aspx

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

Sidebar

Related Questions

This is tricky to explain. We have a DataTable that contains a user configurable
This seems like a really basic thing that I'm doing, yet I'm tearing my
I have basic CSS experienced so I would like to know how can I
I have a class that contains hierarchical data. I want to present this data
I have basic Spring MVC 3 setup for i18n where I can show labels
I have basic hello word example of Prime Faces. I have created dynamic web
I have a basic web service that returns the following object as JSON: public
I have a datatable. I am populating some values into that. e.g. DataTable dt
I have basic authentication set up in a simple CakePHP 2.0 application. I first
I have question that if I have date as string in one column of

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.