You'll need to run two queries. One for the user's query. Then if you
need to get the related books, collect all the related books from the
results, build a second query that will query the BookId field for all
the related books (create an OR query for all the related bookIDs).

Then merge the results from the two queries (manually)

Aviran
http://www.aviransplace.com

-----Original Message-----
From: Dragon Fly [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 12, 2006 10:30 AM
To: java-user@lucene.apache.org
Subject: Related documents ...

Hi,

I have an index that contains 3 fields: Book Id, Book Title, and Related
Book Ids.
For example:

=====

Book Id         Book Title      Related Book Ids

A0001           Title 1         A0003, A0004
A0002           Title 2
A0003           Title 3         A0001, A0002
A0004           Title 4
....
....

=====

Note that the related book id field can be empty.  My application allows
the users to search for a book title and optionally return the related
books.  For example:

(Book Title = "Title 3") and (Return Related Books = false) This should
return the Lucene document for A0003 only and can be implemented easily.

(Book Title = "Title 3") and (Return Related Books = true) This should
return the Lucene documents for A0003, A0001, and A0002.  What is a good
way to implement this? Thank you.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's
FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to