How can I use Java to search a database by keywords?
I have seen some people right programs that can search databases by keywords and set a percent score. So for example someone could enter the key word bloo% witha 95 percent scoring and get results that would include blood, blood type, blood type lab, etc. What is this type of searching called? And is there documentation on how to write a java tool to do this? Thanks for any help and information?
2 Responses
Sergey P
22 Sep 2009
Mike S
22 Sep 2009
it is called ‘full text search’
some databses have already functionality to support it.
It is very broad topic, but basically
search term is split and search for individual terms is executed giving different score multiplied by weight factor depending on algorithm, All scores are then added and displayed.
Search for ‘full text search algorithms’ on the web.





You really ask about two different things.
First thing is ability of Java to connect to database. Usual way to connect from Java to DB is to use JDBC. You can find more information about JDBC at http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/JDBC20.html
After you connected to SQL database from Java, you can execute various SQL queries. Most of modern databases have ability to perform search that you need. Name of that search is "full text search". If you use MySQL, here is information about full text search: http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html
Please note that both JDBC and full text search require advanced knowledge of underlying technologies – Java and SQL.