Our application support the View model, as you know, each View has its own query to filter the data that should appear in this View from DB.

And Our business require us to create a separate lucene index directory for each table in the DB.

Now am planning to use the full text index to retrieve and filter this View data. is that possible to join between this separate index directories ? if so, then how could i do this ?

有帮助吗?

解决方案

You can search multiple indexes at once using a MultiReader. Just open readers normally on each of the indexes, and create the MultiReader, passing those readers into the constructor, like:

IndexReader reader1 = DirectoryReader.open(directory1);
IndexReader reader2 = DirectoryReader.open(directory2);
MultiReader multiReader = new MultiReader(reader1, reader2);
IndexSearcher searcher = new IndexSearcher(multiReader);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top