--
On Thu, 30 May 2002 14:24:46
Dinesh Gupta wrote:
>Hi
> I am looking for database indexing using lucene. I got the
>information that i have to use InputStream class for this. but i have
>not got much help from the lucene API help. can anybody help me out?
If you mean index document stored inside a database:
- Your database must support LOB (Large Object) if docs are > then some kb.(usually 4 0r 8 kb)
- It will give to you the oppurtunity to read this document using InputStream or Reader. In Oracle i do something like:
1.
PreparedStatement ps_open_clob = con.prepareStatement("SELECT * FROM BINARY_DOCS WHERE PK = ?");
ps_open_clob.setLong(1,pk);
tempRs = ps_open_blob.executeQuery();
tempRs.next();
oracle.sql.BLOB objBlob =((oracle.jdbc.driver.OracleResultSet)tempRs).getBLOB("DOCUMENT");
try
{
InpuStream is = objClob.getBinaryStream();
//create your document
//add doc to index
}
catch(SQLException se)
{
}
THIS WORKS FOR BINARY DOCUMENT LIKE: PDF, DOC,WDC, ETC
2.
PreparedStatement ps_open_blob = con.prepareStatement("SELECT * FROM DOCS WHERE PK = ?");
ps_open_clob.setLong(1,pk);
tempRs = ps_open_clob.executeQuery();
tempRs.next();
oracle.sql.CLOB objClob =((oracle.jdbc.driver.OracleResultSet)tempRs).getCLOB("DOCUMENT");
try
{
Reader reader = objClob.getCharacterStream();
//create your document
//add doc to index}
catch(SQLException se)
{
}
THIS WORK WITH ASCII DOCUMENT: TXT, XML, HTML, ETC.
You can get the InputStream from the CLOB too, but you will work with byte instead of char, so depends how you want to use.
Add to index mean use this stream or reader inside your Document class, you should add a field using this stream or reader and then add your document to the index.
hope helps.
Bye.
>
>Regards
>Dinesh
>
>
>--
>To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
>
>
________________________________________________________
Outgrown your current e-mail service?
Get a 25MB Inbox, POP3 Access, No Ads and No Taglines with LYCOS MAIL PLUS.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus --
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>