This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes how to build a search engine? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to build a search engine?" Watch "how to build a search engine?" New topic
Author

how to build a search engine?

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Hi All,

I would like to build a search engine in my application. For this I have a text box where the user can input any text. I would like to search (%like%) for the text the user has provided against all tables/columns in the db.

is there any design pattern for which I should use to achieve this? I don't wish to build a query with m*n (tables X columns) with any %like% statement.

thank you
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
I don't think we have design pattern for this (at least I am not aware of) What will you do with the search result? If you need to search through more than one column the best way is to have concatenated value of all the key columns as one column or through view and search the result. However if the query is based on the view there is possibility that this query may never return or timeout.

If this search feature is really important the best way I would do is
- Create a new column with concatenation of all the key columns
- Create text/interMedia index (I assumed you were using Oracle from syntax %LIKE%)


I don't wish to build a query with m*n


You don't have to manually write the SQL, you can generate the SQL using the meta data tables like ALL_TABLES, ALL_TAB_COLUMNS (in Oracle) . I wouldn't try this as this wouldn't give me any meaningful information without right indexes.

Explore the text index it has lot for features than simple string match.
[ April 06, 2007: Message edited by: Purushothaman Thambu ]
 
wood burning stoves
 
subject: how to build a search engine?
 
Similar Threads
How to generate queries with random joins
Hibernate Metadata Search
GUI for mapping db tables
Rule based systems
Designing a multiple Join query