This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Can anyone help me with the Logic! Pls! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Can anyone help me with the Logic! Pls!" Watch "Can anyone help me with the Logic! Pls!" New topic
Author

Can anyone help me with the Logic! Pls!

Swaminathan Balasubramani
Ranch Hand

Joined: Apr 12, 2005
Posts: 38
hi

Im developing a search engine...can anyone help me with the logic and if possible with the sample code.

Actually the content which are to be searched are in a folder and the meta data about each data item in the folder is stored
in the Oracle datadase

The Database structure is

Name Null? Type
----------------------------------------- -------- ----------------------------
F_ID NOT NULL VARCHAR2(50)
F_NAME NOT NULL VARCHAR2(30)
FILE_EXT NOT NULL VARCHAR2(10)
DATE_CREATION NOT NULL DATE
DATE_LUPDATE NOT NULL DATE
D_ID NOT NULL VARCHAR2(25)
KEYWORDS NOT NULL VARCHAR2(256)
PATH NOT NULL VARCHAR2(256)

the Keyword field holds all the keywords of that particular file. The keywords are stored in sequence seprated by comma
for example the keyword is like "key1,key2,key3,key4".

The user enters the searck key in the search field. The key entered by the user should be searched with all the keywords within
the database..All the match should be listed and on clicking the match that particular file should be invoked..

CAn anyone help me with the logic..

Thanks in advance for the anticipated reply.


B.Swaminathan<br /> <br />Mobile:+91 09886510453
pradeep jaladi
Ranch Hand

Joined: Nov 21, 2004
Posts: 65
Hi,

You can write one Jdbc program with stored procedure with the keys as the input parameters will suit your problem i think.


Pradeep.Jaladi
Swaminathan Balasubramani
Ranch Hand

Joined: Apr 12, 2005
Posts: 38
Thanks Pradeep!

but actually what i want is the procedure for accompalishing the task..I want sample codes..I want sample code for retriving the information and storing the values in a variable and searching the value aganist the Search key and print the result..

The result should be a link to the file..

Pls help! Its kind of Urgent..
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Sorry, I think this is not the way. You need to start off with some logic, incase having issues, get back to us. We will try our best to give you the best.

Thanks.
Roshini Sridharan
Ranch Hand

Joined: Jan 16, 2001
Posts: 143
Hi,

Hope the following idea will help u.



U can then navigate thru the resultset to display the filename and other details.. U can then use FileStream Classes to retrieve the content of the file as the user chooses any match from the result.

Could u tell whether u r developing it for web or as a network application.

Hope this helps.

Regards
Roshini
Swaminathan Balasubramani
Ranch Hand

Joined: Apr 12, 2005
Posts: 38
Thank Andeel!

Can u help me with some logic..if what i've mentioned is not the feasible way of searching..

Thanks Roshini!

Thanks for the code..

I have the keywords seperated by commas within keywords field.For Exanple tthe data in the keyword field is "Key1,Key2,Key3" and if the Users Search Key is "Key2", then the Key2 exist in the Keyword field..this kind of searching should be done and the result should be a link to the file..

Can u please help me out in reaching a solution..
Roshini Sridharan
Ranch Hand

Joined: Jan 16, 2001
Posts: 143
the code i have given does the work of searching in the db for the record that contains the keyword given as searchstring.

Pls clarify whether its a web based search or simple network application.

If its a network application u have to open the file based on the file name from the record and read the content of it and write through the socket.. and in the other end read the data's from the socket and display.

If Web app, u have to create .html file with hyperlinks that point to URL where the file is located, based on the match selected.

Hope this helps

Regards
Roshini
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Swaminathan,

Nobody is going to write this for you.
If while writing it yourself, you get tripped up on some detail, we're all more than happy to help out, but only if we see that you are writing it yourself.

If the current project is too complicated for you to grasp, step back a bit and find some JDBC and/or Servlet tutorials. Follow them and then try some simple projects until you feel that you understand things better

Google is your best friend when looking for tutorials:
http://www.google.com/search?hl=en&q=JDBC+TUTORIAL&btnG=Google+Search
http://www.google.com/search?hl=en&lr=&q=SERVLET+TUTORIAL&btnG=Search
http://www.google.com/search?hl=en&lr=&q=SERVLET+JDBC+TUTORIAL&btnG=Search


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Swaminathan Balasubramani
Ranch Hand

Joined: Apr 12, 2005
Posts: 38
Thanx Roshini!

Thanx Ben!

Ben, actually im not expecting anyone of u to write the code..Actually what i want is Sample Code, i mean, if u have ever come across such implementation...pls try to help me with the Sample Code and this is what i'm expecting.

with regards!
Swami
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I think the code that Roshini posted should be enough to get you going.
S/He's using the SELECT keyword with LIKE and wildcard chars on either end of the entered string.
[ May 11, 2005: Message edited by: Ben Souther ]
Byron Estes
Ranch Hand

Joined: Feb 21, 2002
Posts: 313
Consider Regular Expressions if you want to increase the power to the search.
[ May 12, 2005: Message edited by: Byron Estes ]

Byron Estes<br />Sun Certified Enterprise Architect<br />Senior Consulant<br />Blackwell Consulting Services<br />Chicago, IL<br /><a href="http://www.bcsinc.com" target="_blank" rel="nofollow">www.bcsinc.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can anyone help me with the Logic! Pls!