Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8528535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:49:21+00:00 2026-06-11T08:49:21+00:00

I have two Lucene indexes that I’m trying to open together with a ParallelCompositeReader

  • 0

I have two Lucene indexes that I’m trying to open together with a ParallelCompositeReader in Lucene 4.X. Both indexes contain the same number of documents (14365790) in the same order. My code looks like:

val articlesReader = DirectoryReader.open(FSDirectory.open(...))
val citationCountReader = DirectoryReader.open(FSDirectory.open(...))
val reader = new ParallelCompositeReader(articlesReader, citationCountReader)

When I run this code, I get the following error:

Exception in thread "main" java.lang.IllegalArgumentException: All readers must have same number of subReaders
    at org.apache.lucene.index.ParallelCompositeReader.validate(ParallelCompositeReader.java:147)
    at org.apache.lucene.index.ParallelCompositeReader.prepareSubReaders(ParallelCompositeReader.java:100)
    at org.apache.lucene.index.ParallelCompositeReader.<init>(ParallelCompositeReader.java:71)
    at org.apache.lucene.index.ParallelCompositeReader.<init>(ParallelCompositeReader.java:64)
    at org.apache.lucene.index.ParallelCompositeReader.<init>(ParallelCompositeReader.java:58)

Some information about the indexes:

  • The articlesReader index contains information such as the title, abstract and year of publication for each article. It was created by someone else a couple years ago, using Lucene 3.X. It’s very big and time consuming to re-create, so I’d prefer not to modify this if at all possible

  • The citationCountReader index contains the citation count for each article. It was created by iterating over the articlesReader. It’s a Lucene 4.X index. This one only takes a few hours to re-create, so if I have to re-create anything, I’d prefer to modify this one. (Though of course, I’d prefer not to have to re-create either.)

I dug a bit into the source of ParallelCompositeReader, and it seems that this error is thrown because .getSequentialSubReaders() returns a list of size 1 for articlesReader, but a list of size 3 for citationCountReader. But I don’t know what SequentialSubReaders are or how to make them the same across the two indexes. And it’s quite possible that this isn’t the key issue and/or there’s a better solution to my problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:49:22+00:00Added an answer on June 11, 2026 at 8:49 am

    Ok, it turns out the issue was that the two indexes had different numbers of segments. So I had to force the merge of the index with multiple segments into a single segment. Here’s what I did:

    val config = new IndexWriterConfig(Version.LUCENE_40, ...)
    config.setOpenMode(IndexWriterConfig.OpenMode.APPEND)
    val indexWriter = new IndexWriter(FSDirectory.open(...), config)
    indexWriter.forceMerge(1)
    indexWriter.close
    

    Once both indexes had a single segment, then .getSequentialSubReaders() returned a list of size 1 for both readers, and the ParallelCompositeReader was able to load them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two queries that find both the Zip codes, and the States for
I have a requirement to find items in a Lucene index that have two
All of my Lucene.net (2.9.2) documents have two fields: categoryid bodytext bodytext is the
I have a question regarding Lucene scoring. I have two documents in the index,
I am trying to index in Lucene a field that could have RDF literal
I have two lucene indexes and i need to search on the two indexes.
I have two columns say Main and Sub . (they can be of same
I have two update panels on a page. And I want to update both
If I have two types of documents to index, and I'm using two different
I have made the code to find the similarity between two documents by finding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.