Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 2903 invoked from network); 5 Nov 2006 05:56:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Nov 2006 05:56:18 -0000 Received: (qmail 18858 invoked by uid 500); 5 Nov 2006 05:56:24 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 18817 invoked by uid 500); 5 Nov 2006 05:56:24 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 18806 invoked by uid 99); 5 Nov 2006 05:56:24 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Nov 2006 21:56:24 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [205.207.78.3] (HELO tormail01.cihi.ca) (205.207.78.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Nov 2006 21:56:11 -0800 Received: from (tormail01.cihi.ca [10.64.1.106]) by webshield.cihi.ca with smtp id 1486_1f4bd4ca_6c93_11db_8e98_003048245df9; Sun, 05 Nov 2006 01:01:50 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C7009E.F60ED103" Subject: injecting fields looked up from DB at the runtime - Solr/Lucene question Date: Sun, 5 Nov 2006 00:55:13 -0500 Message-ID: <373399D6389D8C42B4EAD9BE2B6B5C5F070D152D@tormail01.cihi.ca> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: injecting fields looked up from DB at the runtime - Solr/Lucene question Thread-Index: AccAnvXannAfypbSQNGrFmzf8kJ9PQ== From: "Vladimir Olenin" To: X-Virus-Checked: Checked by ClamAV on apache.org ------_=_NextPart_001_01C7009E.F60ED103 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I wonder if the below is the correct way of doing things... - when the Hits objects are returned from IndexSearcher (as a result of = some search), 'inject' 'info' fields into the 'Hit' objects at runtime = by looking the values up in the DB. The main purpose is to avoid storing = 'info' fields in the index as 'stored' fields. * in other words, I want to keep in Lucene index ONLY 'indexed' fields = and keep all 'stored' fields (some of which might be big BLOB entries) = in relational DB. I do want however to provide 'generic' transparent = access to these stored fields through Lucene APIs (one of the rational = is to be able to use some frameworks around, like Solr, transparently, = no matter which fields are stored in index and which are stored in the = DB). I wonder if adding 'Fields' to the returned Document object (linked with = Hit object) will do the trick for me? In other words, will the below = work? Hits hits =3D indexSearcher.search(luceneQuery); HitsIterator iter =3D (HitsIterator)hits.iterator(); Hit hit =3D (Hit)iter.next(); Document doc =3D hit.getDocument(); String docId =3D doc.getField("docId"); doc.addField(getFieldBy("someStoredDBField", docId)); Would this disturb the index in any way? Would this be reflected in all = other objects in the returned Hits set (eg, will = 'hit.get("someStoredDBField")' return the value looked up in the DB?) Thanks. Vlad ------_=_NextPart_001_01C7009E.F60ED103--