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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:16:06+00:00 2026-06-01T00:16:06+00:00

I am a newbee to solr.I am having a problem with adding fields/metadata to

  • 0

I am a newbee to solr.I am having a problem with adding fields/metadata to pdf files while indexing them in solr using the ContentStreamUpdateRequest.As the literal parameter must be used to add fields I tried the following:

public static void indexFilesSolrCell(String fileName,String solrId,int i,String name,String Category,String loc,String locat) 
                    throws IOException, SolrServerException {
    //...
    ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update/extract");
    File f1 = new File(fileName);
    up.addFile(new File(fileName));
    up.setParam("literal.id",solrId);
    up.setParam("literal.name",name );
    up.setParam("literal.url_file", loc);
    up.setParam("literal.location",locat);
    up.setParam("literal.Category",Category);
    //..
}

The pdf file gets indexed in solr but the problem is that Not all the fields have been created using literals.The following fields have been created:

  1. id
  2. name
  3. Category.

    While it does not create fields like url_file or anything like path or location.*At times* it does not create the field Category.

    As of what I have gone through, any random field could be created using the literal parameter to create a metadata.Why is that fields like id or name or even blah_s are created always but when I try a random field like the above mentioned,solr does not create?
    Do we have to declare these random fields anywhere else as well?

    Any help is greatly appreciated.

    Update: Doesn’t calling the method up.setParam(“literal.myField”) modify the schema.xml to create a new field?

  • 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-01T00:16:08+00:00Added an answer on June 1, 2026 at 12:16 am

    That’s because you’re using the solr examples, which doesn’t contain the url_file and location fields. You can find the schema.xml under example/solr/conf. I suggest you to clean it up a little keeping only the fields you need, since that schema contains a lot of fields you don’t really need.

    The blah_s field gets created because the schema you’re using contains the following definition:

    <dynamicField name="*_s" type="string"  indexed="true"  stored="true"/>
    

    It’s a dynamic field with suffix _s, it means every field with that suffix will be taken by Solr as string, indexed and stored as well.

    To modify the schema.xml you need to open it locally and make changes to the xml file, then reload Solr. Remember that after a schema change you need to reindex, re-running the code you pasted in your question.

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

Sidebar

Related Questions

Newbie here programming my first app (having made several tutorial apps). I am using
I got the following function while googling for bot behaviour. while i am using
All, Question 1 while using templates, Compiler error information is known to be very
I'm a relative newbee to Android/Java and about to despair over a problem I
I am newbee with PHP and MySQL and need help... I have two tables
Solr newbie here. I have created a Solr index and write a whole bunch
I am newbee to jquery and have some work assigned to me to complete
Well I am a newbee so kindly please ignore if there is any mistake
I'm guessing this will be such a newbee question but I hit a wall
Still new to the memory management in iPhone apps, I have a newbee question.

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.