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 7731351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:27:30+00:00 2026-06-01T06:27:30+00:00

I have written a custom request handler in solr to meet my business requirements.

  • 0

I have written a custom request handler in solr to meet my business requirements. The handler involves getting data from two different from SolrIndexSearchers. I want the returned doclists from the two SolrIndexSearchers merged into one.

I tried iterating through one and adding doc by doc to another, but all I could get was an “Unsupported Operation” exception. Is there anyway to merge two doclists?

[Edit 1] : Code snippet inside the overridden handleRequestBody method

   SolrCore core = new SolrCore("Desired Directory 1", schema);
   reader = IndexReader.open("Desired Directory 1");
   searcher = new SolrIndexSearcher(core, schema, getName(), reader, false);
   Sort lsort = null;
   FilteredQuery filter = null;
   DocList results1 = searcher.getDocList(query, filter, lsort, 0, 10);
   reader.close();
   searcher.close();
   core.close();
   SolrCore core = new SolrCore("Desired Directory 2", schema);
   reader = IndexReader.open("Desired Directory 2");
   searcher = new SolrIndexSearcher(core, schema, getName(), reader, false);
   Sort lsort = null;
   FilteredQuery filter = null;
   DocList results2 = searcher.getDocList(query, filter, lsort, 0, 10);
   reader.close();
   searcher.close();
   core.close();
   rsp.add("response",results1);
   rsp.add("response",results2);

Now that I have two DocLists results1 and results2, how do I merge them?

[Edit 2] : The problem is not an exception/stack trace. When I add two responses, I get the results in two response sets when it is a single machine search. When it is a distributed search, I only get the distribution between response 1 of machine 1 and response 1 of machine 2. IN my understanding, only when I merge the responses to a single set, I will be able to get proper distribution. Hope I am understandable?

  • 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-01T06:27:31+00:00Added an answer on June 1, 2026 at 6:27 am

    DocList is not supposed to be changed after you retrieve it from a search result.

    I had the similar problem and, if I remember correctly, I used:

    org.apache.solr.util.SolrPluginUtils.docListToSolrDocumentList
    

    to convert DocList to SolrDocumentList, which extends ArrayList<SolrDocument>, which consequently supports add(SolrDocument).

    So the worst case scenario (from the performance standpoint) is to convert the first DocList to SolrDocumentList and then loop through all other DocLists calling add on each doc.
    You’ll have to test how efficient this approach is. I’m not Solr expert, but this is where I’d start testing.

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

Sidebar

Related Questions

I have written a custom Windows Service that writes data to a custom Event
I have written custom delegate methods in ClassFile(B), now i am calling them from
I have written a custom control in C# (inherited from Forms.Control) and it seems
I have written a custom class to handle database queries to a remote and
I have written a custom class for overriding the seek method of QSlider. Basically
I have written a custom Django Model Field to store dateutil.relativedelta 's. The field
I have written a custom server control which (pseudo-code) looks like public class MyCustomCtrl
I'm using nant to build our product and have written a custom task to
I have a custom built application framework written in PHP which I have been
I have a custom component called ButtonPanel written in Actionscript. Basically it's just a

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.