Hi Feng, Hmmm, but Document is a Java object? It holds all kinds of other objects like Sets, Lists, Maps, Strings, Doubles, ... Can we store Java objects in a Lucene index?
Jochen 2012/7/3 feng lu <amuseme...@gmail.com> > and you can add d as a field with STORE and NOT_ANALYZER tag to it if d in > Document is not large. > > On Tue, Jul 3, 2012 at 4:04 PM, Chris Lu <chris...@gmail.com> wrote: > > > Can you index the rule1 and rule2 fields into the documents, and when > > searching with the keywords, also append rule1:foo and rule2:bar to the > > query? > > > > Chris > > ------------------------- > > Instant Scalable Full-Text Search On Any Database/Application > > site: http://www.dbsight.net > > demo: http://search.dbsight.com > > Lucene Database Search in 3 minutes: http://wiki.dbsight.com/index.** > > php?title=Create_Lucene_**Database_Search_in_3_minutes< > http://wiki.dbsight.com/index.php?title=Create_Lucene_Database_Search_in_3_minutes > > > > DBSight customer, a shopping comparison site, (anonymous per request) got > > 2.6 Million Euro funding! > > > > > > On 7/3/12 12:56 AM, Jochen Hebbrecht wrote: > > > >> Hi all, > >> > >> I have an application which holds a list of documents. These documents > are > >> indexed using Lucene. > >> I can search on keywords of the documents. I loop the TopDocs and get > the > >> ID field (of each Lucene doc) which is related to the ID column in my > >> relational database. From all these ID's, I create a list. > >> After building the list of ID's, I make a database query which is > >> executing > >> the following SELECT statement (JPA): > >> > >> << > >> SELECT d From Document WHERE id IN (##list of ID's retrieved from > >> Lucene##) > >> This list of document is sent to the view (GUI). > >> > >> > >> But, some documents are private and should not be in the list. > Therefore, > >> we have some extra statements in the SELECT query to do some security > >> checks: > >> > >> << > >> SELECT d From Document WHERE id IN (##list of ID's retrieved from > >> Lucene##) > >> AND rule1 = foo > >> AND rule2 = bar > >> But now I'm wondering: I'm using the speed of Lucene to quickly search > >> documents, but I still have to do the SELECT query. So I'm loosing > >> performance on this one :-( ... > >> Does Lucene have some component which does this mapping for you? Or are > >> there any best practices on this issue? How do big projects map the > Lucene > >> results to the relation database? Because the view should be rendering > the > >> results? > >> > >> Many thanks! > >> Jochen > >> > >> > > > > > > > -- > Don't Grow Old, Grow Up... :-) >