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

  • SEARCH
  • Home
  • 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 8259959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:58:46+00:00 2026-06-08T02:58:46+00:00

I set up a Solr Server on a TomCat-Servlet. In my Index there are

  • 0

I set up a Solr Server on a TomCat-Servlet. In my Index there are about 610.000 Documents with several fields. My schema.xml:

<field name="ID" type="myText" indexed="true" stored="true" required="true" />
<field name="text" type="myText" indexed="true" stored="false" multiValued="true" />
<dynamicField name="AT*" type="text_general" indexed="true" stored="true" multiValued="true" />

To search the Index with a given String (might be from another system) I created a little JavaProgram

class SolrjTest
{
public static void main(String[] args) throws IOException
{
SolrjTest solrj = new SolrjTest();
solrj.query(args[0]);
}
public void query(String q) throws IOException
{
CommonsHttpSolrServer server = null;
String uuid = null;
boolean flag = true;
while(flag==true)
{   
uuid = UUID.randomUUID().toString();
File f = new File("E:/dw-solr/tomcat-solr/bin/solr/data/SearchResult/"+uuid+".txt");
if(!f.exists()){
flag = false;
}
}
try
{
server = new CommonsHttpSolrServer("http://localhost:8080/solr");
}
catch(Exception e)
{
e.printStackTrace();
}
SolrQuery query = new SolrQuery();
query.setQuery(q);
FileWriter fw = new FileWriter("E:/dw-solr/tomcat-solr/bin/solr/data/SearchResult/"+uuid+".txt");
try
{
QueryResponse qr = server.query(query);
SolrDocumentList sdl = qr.getResults();

Object[] o = new Object[sdl.size()];
o = sdl.toArray();
for (int i = 0; i < o.length; i++) {
System.out.println(o[i].toString());
fw.write(o[i].toString() + "\n");
}
fw.flush();
fw.close();
System.out.println("finished");
}
catch (SolrServerException e)
{
e.printStackTrace();
}
}

And the results are saved in files. The problem is, that the format of the data is really strange. It looks like:

“SolrDocument[{ID=0000000, AT_anyName=[anyValue, multiValue, justMoreValue], AT_anyName2=[Normal,Normal, Normal], AT_mightbeanothername=[couldbealoooooooooooooooongvalue, andanotherone, andanotherone]muchMoreStuff…about 20 – can differ from ID to ID}]”

What I want to have, is a clear XML-format for this data. So I save it as a XML-file and send it back to the other System. The problem is, that the Method SolrDocumentList sdl = qr.getResults(); return the result as shown above. As I posted before, I have dynamicFields so stuff get really complicated (at least for me :-/ ).
Is there any solution, how I can change the format to a plain, clear XML-format?

Thanks a lot for any help.

Best regards

  • 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-08T02:58:48+00:00Added an answer on June 8, 2026 at 2:58 am

    Response Writers is used to generate different formats of the search responses.By default it returns the XML response. By sending the HTTP request you can get response in xml format.

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

Sidebar

Related Questions

We have set up an Solr index containing 36 million documents (~1K-2K each) and
We're running Solr 3.4 and have a relatively small index of 90,000 documents or
I have installed a servlet (solr) that requires that I set the variable solr.solr.home
I've set up my first 'installation' of Solr, where each index (document) represents a
I am trying to query Solr using the SolrNet client. I can index documents
The SolrInstall wiki page lists seven different server / Servlet Containers compatible with Solr:
I have a search in solr that is returning about 1500 documents. These documents
I used Ubuntu 8.10 as the Solr server OS, and set: solr.solr.home=home/huenzhao/search/tomcat6/bin/solr. When I
I'm using a simple PHP library to add documents to a SOLR index, via
I have a solr search engine set up with multiple fields and I want

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.