Creating a Full Text Search

Hi,

I am fairly new to vb.net, and I am looking to create a full text based search. I dont know how do i do it. Is there any open source componnet available? Please suggest me.

Regads,
Prerak
PPPimpactAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
A full text based search of what?  A text document?  A word document?  A database?  something else...?
0
planoczCommented:
Hi,

Here is where I found good examples for getting started in VB.Net
Also in the 101samples there is an app called "VB.NET - Windows Forms - Use Regular Expressions"
using Regular Expressions is one way to in a search app.

.....http://msdn.microsoft.com/vbasic/downloads/samples/101samples.aspx

Link for ASP programs...

http://msdn.microsoft.com/asp.net/downloads/kits/default.aspx 
0
PPPimpactAuthor Commented:
Full text search from a database.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

jrcooperjrCommented:
What type of database are you trying to search?  I just finished an application to allow users to do search for text in fields of an Oracle database if that might be applicable.
0
PPPimpactAuthor Commented:
Yup that s what i am looking for ....I have a field that contains the description of various products...i need to create an application that will search against the product description field....my database is sqlserver...

Regards,
Prerak
0
PPPimpactAuthor Commented:
planocz thanks for the link...the first one seems to be a bit confusing but helpful.
0
PPPimpactAuthor Commented:
jrcooperjr can you share the logic of your application.

Regards,
Prerak
0
jrcooperjrCommented:
Hi.... as I said, I am searching against an Oracle database... oracle has a nice functionality for full-text searching... you can build an index on a field in a table that contains text, and then use a special command in an SQL statement to select the rows that contain your target text... however, for sqlserver, you should be able to just set up an sql command that selects rows where your text field is "like" your target...
for example, let's say you are searching for the word "silver" in the description field in a table named TABLE1 that has fields "description" and "productnumber"..
your SQL might look something like "select productnumber from TABLE1 where description like '%silver%' "

Your vb application would basically have a space for your user to enter the search text, and some kind of display to show the results... my code looks something like the following (I believe there are SQLserver equivalents of the Oracle connection and reader commands I use below)...  

**********************************
          strsearchstring = "silver"  '''' just an example... you would of course actually fill this with whatever the user entered
          strSQLstring = " select productnumber from table1 where description like '%" & strsearchstring & "%'"

          iint = 0    '''' I use this as a counter
    ''''' this assumes you've connected to your database by doing an open with the connection
          cmdOracleCommand.CommandText() = strSQLString
          cmdOracleCommand.Connection() = conOracleConnection
          cmdOracleCommand.CommandType = CommandType.Text
    '''' the following actually executes the SQL command and returns a result set
          Dim rdrOracleReader As OracleDataReader _
                           = cmdOracleCommand.ExecuteReader
              ListBox1.Items.Clear()   ' clear list box of previous contents... using listbox1 to display the results
              While rdrOracleReader.Read   ' loop for each row returned
                     iint = iint + 1  '  increment counter
                     ListBox1.Items.Add(" product number is " + rdrOracleReader.Item(0) )
              End While
              If iint = 0 Then    '''' just in case nothing was found
                  ListBox1.Items.Add("No items found ")
              End If
        ListBox1.Show()
        rdrOracleReader.Close()
        conOracleConnection.Close()


good luck!
0
PPPimpactAuthor Commented:
Hi,

Thanks for the reply. I just need to clarify certain things. As far as my understanding goes, this would work if somebody put a string for search.E.g. "silver", it will search for the string "silver" and return the results. Please correct me if i am wrong.

What I am looking for is allowing "+", "-", and other operations. For e.g.
" silver - glass" would return the results that have silver in it but not glass.

Please suggest me,

Regards,
Prerak
0
jrcooperjrCommented:
Hi... for the search you wish, you need to adjust the SQL statement.... to search for "silver" but not "glass" you could do a statement something like:

"select productnumber from TABLE1 where description like '%silver%' and not description like  '%glass%' "

(you can keep on adding logical conditions)

There are lot's of ways to parse this type of logic... the trick, of course, (unless you trust your users to write the SQL statement themselves) is to represent the possibilities with user-input variables.... depending upon how complex I want to allow the search to become, I'll have several text boxes on my user input screen..
I might have the first box be the first word or phrase, the second box be a combo box with logical conjunctions (i.e., "AND" "OR" "NOT") another box for the second word or phrase, etc.  then just build the SQL string by concatenating the contents of the boxes...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.