how to design a search engine
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   paluri_chandra
Posted On:   Saturday, December 3, 2005 02:52 AM






Hi all,
I have designed a web based application using jsp,servlets & database as oracle.Now i want to have a search engine that can access tables in my database and retrieve the records.For example the user may perform search using name,emailid,phone number etc.
Please suggest how to proceed.



Re: how to design a search engine

Posted By:   piyush_nahata  
Posted On:   Saturday, December 10, 2005 07:41 AM



Lets say in your jsp page yuo have 3 text boxes with the
name as follows.
empName
empMailId
empPhoneNo
This is what you can do to form the query to search from the
database assuming you have a single table named
tblEmpInfo with the fields fName,fMailId,fPhoenNo.

boolean flag = false;
String query = "select * from tblEmpInfo ";

if(empName != null && empName != ""){
if(!flag)
flag = true;
query += "where fName = '"+ empName + "'";
}

if(empMailId != null && empMailId != ""){
if(!flag) {
flag = true;
query += "where fmailId = '"+ empMailId + "'";
} else {
query += "and fmailId = '"+ empMailId + "'";
}
}

if(empPhoneNo != null && empPhoneNo != ""){
if(!flag) {
flag = true;
query += "where fPhoenNo = '"+ empPhoneNo + "'";
} else {
query += "and fPhoenNo = '"+ empPhoneNo + "'";
}
}

Regards,

Piyush

About | Sitemap | Contact