To allow deleting the document block all at once, here is another possibility:
In addDocuments() function, add an internal field, i.e., "_num_children_docs_", for the number of children documents. Since the doc ID of all parent/children documents are consecutive, we can use this internal field together with the docID of the parent doc to remove the whole doc block. Here we assume the parent doc is given a doc ID first during the indexing time. Wei On Sun, Mar 3, 2013 at 11:54 AM, Wei Wang <welshw...@gmail.com> wrote: > I see. Probably assigning blockID is the most efficient way. Thanks. > > On Sun, Mar 3, 2013 at 7:39 AM, Michael McCandless > <luc...@mikemccandless.com> wrote: >> IndexWriter doesn't track the blocks ... so you need to something yourself. >> >> One approach is to add a Field, eg blockID, with the same value (maybe >> the id of the parent doc) to parent and child docs, and then delete by >> that. >> >> You may also get away with just deleting the parent or just the >> children, but this can make searches more costly as the parent/child >> docs will be matched only to then discover that they don't join to >> anything. >> >> Mike McCandless >> >> http://blog.mikemccandless.com >> >> >> On Sat, Mar 2, 2013 at 11:34 PM, Wei Wang <welshw...@gmail.com> wrote: >>> Hello, >>> >>> I understand BlockJoinQuery can be used to index nested documents with >>> some internal structure. And at indexing time, addDocuments is used to >>> create document blocks. >>> >>> In case we would like to update some data fields, we have to delete >>> the old document block and add the updated block. How can we delete >>> the old document block efficiently? It seems IndexWriter does not >>> track these blocks. >>> >>> Thanks, >>> Wei >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >>> For additional commands, e-mail: java-user-h...@lucene.apache.org >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >> For additional commands, e-mail: java-user-h...@lucene.apache.org >> --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org