Question

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 ?

Was it helpful?

Solution

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top