469,593 Members | 1,741 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,593 developers. It's quick & easy.

Searching For Close Variations

Using .NET 2.0 (C#) I'm writing a small app that will have a "Person" class
that exposes FirstName and LastName properties. At runtime, a "People"
collection will be populated with a few thousand "Person" objects.

I want to provide users with the ability to search for people by FirstName
and/or LastName.

My question: How can I enable users to search for people with the last name
of [for example] "De Leon". I cannot assume that my users know how to
correctly spell it - so they may be searching with or without the space
(i.e., searching for either "Deleon" or "De Leon").

What are some reasonable/acceptable ways I can search the collection? I'm
wanting to address at least the specifics issue of [spaces within the name].

Thanks!
Jul 20 '06 #1
4 1223
Hey Jordan,

Is the data for people in a Sql Server database? If so, you could
store the value which the Sql Server soundex function returns. Then
you can base you query on searching for values with the same soundex.

HTH
Andy

Jordan S. wrote:
Using .NET 2.0 (C#) I'm writing a small app that will have a "Person" class
that exposes FirstName and LastName properties. At runtime, a "People"
collection will be populated with a few thousand "Person" objects.

I want to provide users with the ability to search for people by FirstName
and/or LastName.

My question: How can I enable users to search for people with the last name
of [for example] "De Leon". I cannot assume that my users know how to
correctly spell it - so they may be searching with or without the space
(i.e., searching for either "Deleon" or "De Leon").

What are some reasonable/acceptable ways I can search the collection? I'm
wanting to address at least the specifics issue of [spaces within the name].

Thanks!
Jul 20 '06 #2
RE:
<< Then you can base you query on ...>>

I'm not querying the db. Instead I want to search the collection of objects
in my app.

Thanks


"Andy" <aj*****@alum.rit.eduwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
Hey Jordan,

Is the data for people in a Sql Server database? If so, you could
store the value which the Sql Server soundex function returns. Then
you can base you query on searching for values with the same soundex.

HTH
Andy

Jordan S. wrote:
>Using .NET 2.0 (C#) I'm writing a small app that will have a "Person"
class
that exposes FirstName and LastName properties. At runtime, a "People"
collection will be populated with a few thousand "Person" objects.

I want to provide users with the ability to search for people by
FirstName
and/or LastName.

My question: How can I enable users to search for people with the last
name
of [for example] "De Leon". I cannot assume that my users know how to
correctly spell it - so they may be searching with or without the space
(i.e., searching for either "Deleon" or "De Leon").

What are some reasonable/acceptable ways I can search the collection? I'm
wanting to address at least the specifics issue of [spaces within the
name].

Thanks!

Jul 20 '06 #3
Jordan,

You can implement a soundex function in your code easily. Here is a web
page that goes into it in some detail:

http://www.creativyst.com/Doc/Articl...1/SoundEx1.htm

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jordan S." <A@B.COMwrote in message
news:Oq**************@TK2MSFTNGP04.phx.gbl...
RE:
<< Then you can base you query on ...>>

I'm not querying the db. Instead I want to search the collection of
objects in my app.

Thanks


"Andy" <aj*****@alum.rit.eduwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
>Hey Jordan,

Is the data for people in a Sql Server database? If so, you could
store the value which the Sql Server soundex function returns. Then
you can base you query on searching for values with the same soundex.

HTH
Andy

Jordan S. wrote:
>>Using .NET 2.0 (C#) I'm writing a small app that will have a "Person"
class
that exposes FirstName and LastName properties. At runtime, a "People"
collection will be populated with a few thousand "Person" objects.

I want to provide users with the ability to search for people by
FirstName
and/or LastName.

My question: How can I enable users to search for people with the last
name
of [for example] "De Leon". I cannot assume that my users know how to
correctly spell it - so they may be searching with or without the space
(i.e., searching for either "Deleon" or "De Leon").

What are some reasonable/acceptable ways I can search the collection?
I'm
wanting to address at least the specifics issue of [spaces within the
name].

Thanks!


Jul 20 '06 #4
Well, the principal would be the same. You'll need to locate something
like the soundex() function on Sql server and implement it in your
code. Then loop though the collection and match anyone that has a
similar soundex value.

Andy

Jordan S. wrote:
RE:
<< Then you can base you query on ...>>

I'm not querying the db. Instead I want to search the collection of objects
in my app.

Thanks
Jul 20 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

18 posts views Thread by Roger Withnell | last post: by
33 posts views Thread by Geoff Jones | last post: by
11 posts views Thread by Michele and John | last post: by
mfshake
4 posts views Thread by mfshake | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.