lucene - Can I know what index MultiReader got a document from? -
i have multireader connected several indexes.
after run query , results, there way know index result from?
i know it's not multireader for. still need this.
you can if 1 create multireader
instance.
you can extend class , implement required functionality. basecompositereader
(super type of multireader
) has readerindex()
, getsequentialsubreaders()
methods. following code should work:
public static class mymultireader extends multireader { public mymultireader(indexreader... subreaders) throws ioexception { super(subreaders); } public indexreader getreaderfordocument(int docid) { return getsequentialsubreaders().get(readerindex(docid)); } }
Comments
Post a Comment