wood burning stoves*
The moose likes Other JSE/JEE APIs and the fly likes Searching a document contents stored in database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Searching a document contents stored in database" Watch "Searching a document contents stored in database" New topic
Author

Searching a document contents stored in database

shailendra Patil
Greenhorn

Joined: Dec 21, 2010
Posts: 3
Hi,
I have a requirement where user will be uploading excel document from UI, I am planning to store that document in database as BLOB.

Now if user wants to perform search from UI based on contents of the documents, respective documents will be displayed as a search result.


I would appreciate any help in this matter as it's driving me crazy to implement the solution.

Regards
Shailendra
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

Welcome to the Ranch!

Storing the document as a BLOB will be good if you need to extract the document, but it will be stored in its binary form. That means you can't search on it.

You should probably use Apache POI, JExcelAPI (a.k.a. jxl) or another library to read the document, then store its readable content in another field (type CLOB probably - a form of text-based BLOB; "text" is another often used name for it) on which you will then search.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
Alternatively, use a library like Lucene to build a search index whenever a document is stored in the DB. The Apache Tika library -a Lucene add-on- can index Excel files (amongst other formats).


Ping & DNS - updated with new look and Ping home screen widget
shailendra Patil
Greenhorn

Joined: Dec 21, 2010
Posts: 3
Thanks Rob & Ulf for your quick reply.


let me try the solution suggested by your guys with Sample program & I'll let you know the result soon.

Hopefully by implementing CLOB datatype it will solve my purpose.
Paul Okeke
Ranch Hand

Joined: May 16, 2009
Posts: 58
Also depending on size files you are storing, it is not advisable to store large files in the base for performance reasons.
Instead saving the files on the hard disk and storing the path of the saved file in the database could be another solution.


OCJP 1.6
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Searching a document contents stored in database
 
Similar Threads
is LAZY loading guaranteed?
Urlybird 1.1.1
How to render documents on to Pages
Lunching MS Word from jsp
Two UIs?