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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:17:49+00:00 2026-06-04T03:17:49+00:00

I am trying to index data from database. I am doing that successfully. But

  • 0

I am trying to index data from database. I am doing that successfully. But I have a problem. I want to use one index for whole database. All the db tables have at least 3 columns with the same name (I want to be like this). For instance I have these tables: members, new_members, books, journals and cds. All these have columns named: id, model, biog. So, in all the db tables the id (auto incremented) starts from 1.
When I am querying Solr using filter (fq=model:journal) it is returning nothing. Querying for books returns a portion of data (I have 5 rows and it returns 2. I am using : in order to retrieve all the rows ). I know that the data is in Solr’s “data” file. I think there is a conflict of some kind.
How can I have a single index with all these tables without any conflicts?

The data-config.xml:

<?xml version="1.0" encoding="utf-8"?>

<dataConfig>

  <dataSource type="JdbcDataSource" 
              driver="com.mysql.jdbc.Driver"
              url="jdbc:mysql://127.0.0.1:3306/rental" 
              user="root" 
              password="1a2b3c4d"/>

  <document>

    <entity name="members" pk="id" transformer="HTMLStripTransformer" query="select id, firstname, lastname, biog, model from members">
        <field column="id" name="id" /> 
        <field column="firstname" name="firstname" stripHTML="true" />
        <field column="lastname" name="lastname" stripHTML="true" />
        <field column="biog" name="biog" stripHTML="true" />
        <field column="model" name="model" stripHTML="true"  />
    </entity>

    <entity name="new_members" pk="id" transformer="HTMLStripTransformer" query="select id, firstname, lastname, biog, model from new_members">
        <field column="id" name="id" /> 
        <field column="firstname" name="firstname" stripHTML="true" />
        <field column="lastname" name="lastname" stripHTML="true" />
        <field column="biog" name="biog" stripHTML="true" />
        <field column="model" name="model" stripHTML="true" />
    </entity>


  <entity name="books" pk="id" transformer="HTMLStripTransformer" query="select id, title, description, model from books">
        <field column="id" name="id" /> 
        <field column="title" name="title" stripHTML="true" />
        <field column="description" name="biog" stripHTML="true" />
        <field column="model" name="model" stripHTML="true" />
    </entity>


  <entity name="journals" pk="id" transformer="HTMLStripTransformer" query="select id, title, description, model from journals">
        <field column="id" name="id" /> 
        <field column="title" name="title" stripHTML="true" />
        <field column="description" name="biog" stripHTML="true" />
        <field column="model" name="model" stripHTML="true" />
    </entity>


  <entity name="cds" pk="id" transformer="HTMLStripTransformer" query="select id, title, description, model from cd">
        <field column="id" name="id" /> 
        <field column="title" name="title" stripHTML="true" />
        <field column="description" name="biog" stripHTML="true" />
        <field column="model" name="model" stripHTML="true" />
    </entity>

  </document>
</dataConfig>

The schema.xml (fields):

<fields>
  <field  name="id" type="string" indexed="true" stored="true" /> 
  <field  name="model" type="text_en" indexed="true" stored="true"  />
  <field  name="firstname" type="text_en" indexed="true" stored="true"/>
  <field  name="lastname" type="text_en" indexed="true" stored="true"/>
  <field  name="title" type="text_en" indexed="true" stored="true"/>
  <field  name="biog" type="text_en" indexed="true" stored="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField> biog </defaultSearchField> 
  • 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-04T03:17:50+00:00Added an answer on June 4, 2026 at 3:17 am

    your uniqueKey is not really unique, you need each entity to have different pk than the others, one easy way is just to append something to the id, for example, for books:

    query="select CONCAT('b-',id) as id,..."
    

    this way book ids will be b-1, b-2, do the same for the other tables with different prefixes

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

Sidebar

Related Questions

Trying to use JSTL but have the following problem: Index.xhtml page: <?xml version=1.0 encoding=UTF-8?>
I'm trying to index data from a database in Solr using the DIH. So
I am trying to make some data from database available using XML, I have
I am trying to import data from a large database. I have two tables
I have an application that stores data in an Oracle database. I want to
I am trying to index a table in a database using Lucene. I use
I am trying to fetch data from my database and when I display it
I am trying to show information from database without reloading the page. I have
I am trying to get data from a specific column in a database table
I have a problem that I have been trying to tackle for the last

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.