[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Creating a Full Text Search

Posted on 2004-11-30
14
Medium Priority
?
277 Views
Last Modified: 2010-05-19
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
0
Comment
Question by:PPPimpact
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 12706959
A full text based search of what?  A text document?  A word document?  A database?  something else...?
0
 
LVL 27

Expert Comment

by:planocz
ID: 12706984
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
 

Author Comment

by:PPPimpact
ID: 12707537
Full text search from a database.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Expert Comment

by:jrcooperjr
ID: 12707904
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
 

Author Comment

by:PPPimpact
ID: 12707927
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
 

Author Comment

by:PPPimpact
ID: 12707970
planocz thanks for the link...the first one seems to be a bit confusing but helpful.
0
 

Author Comment

by:PPPimpact
ID: 12710342
jrcooperjr can you share the logic of your application.

Regards,
Prerak
0
 
LVL 1

Expert Comment

by:jrcooperjr
ID: 12720078
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
 

Author Comment

by:PPPimpact
ID: 12726655
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
 
LVL 1

Accepted Solution

by:
jrcooperjr earned 500 total points
ID: 12728767
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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Screencast - Getting to Know the Pipeline
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question