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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:06:15+00:00 2026-06-15T11:06:15+00:00

I am trying to setup my SOLR to import documents from my SQL file.

  • 0

I am trying to setup my SOLR to import documents from my SQL file. I have found this which should go in the data-config:

<dataConfig>
  <dataSource driver="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/wikipedia" user="wikipedia" password="secret" />
  <document>
    <entity name="page" query="SELECT page_id, page_title from page">
      <field column="page_id" name="id" />
      <field column="page_title" name="name" />
      <entity name="revision" query="select rev_id from revision where rev_page=${page.page_id}">
        <entity name="pagecontent" query="select old_text from pagecontent where old_id=${revision.rev_id}">
          <field column="old_text" name="text" />
        </entity>
      </entity>
   </entity>
  </document>
</dataConfig>

In my case, my schema looks like this:

CREATE TABLE country (
    id integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
    name varchar(255) NOT NULL
)
;

CREATE TABLE location (
    id integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
    name varchar(255) NOT NULL,
    coordinate varchar(255) NOT NULL,
    country_id integer NOT NULL REFERENCES country (id)
)
;

CREATE TABLE item (
    id integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
    title varchar(60) NOT NULL,
    description varchar(900) NOT NULL,
    date datetime NOT NULL,
    source varchar(255) NOT NULL,
    link varchar(255) NOT NULL,
    location_id integer NOT NULL REFERENCES location (id)
)
;

If I want to import the following fields into Solr:

id
title
description
date
source
link
location(name)
location(co-ordinates)

Can someone please help me on my way to change the example data-config to use my data. What I am confused about are when to use “entity” and when to use “field column”.

  • 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-15T11:06:17+00:00Added an answer on June 15, 2026 at 11:06 am

    You can do it two ways e.g. :-

    Create a Simple SQL query with Join between Item and Location

    <document name="items">
        <entity name="item" query="SELECT A.ID, A.TITLE, A.DESCRIPTION, A.DATE, A.SOURCE, B.COORDINATE , C.NAME FROM ITEM A, LOCATION B, COUNTRY C WHERE A.LOCATION_ID = B.ID AND B.COUNTRY_ID = C.ID">
            <field column="ID" name="id" />
            <field column="TITLE" name="title" />
            <field column="DESCRIPTION" name="description" />
            <field column="DATE" name="date" />
            <field column="SOURCE" name="source" />
            <field column="COORDINATE" name="coordinate" />     
    
        </entity>
    </document>
    

    Using subentities :-

    <document name="items">
        <entity name="item" query="SELECT A.ID, A.TITLE, A.DESCRIPTION, A.DATE, A.SOURCE, B.COORDINATE , C.NAME FROM ITEM A, LOCATION B, COUNTRY C WHERE A.LOCATION_ID = B.ID AND B.COUNTRY_ID = C.ID">
            <field column="ID" name="id" />
            <field column="TITLE" name="title" />
            <field column="description" name="description" />
            <field column="DATE" name="date" />
            <field column="SOURCE" name="source" />
    
            <entity name="location" query="select coordinate from location where id='${item.ID}'">
                <field name="coordinate" column="coordinate" />
            </entity>
    
        </entity>
    </document>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to setup a search engine using Solr (or Lucene) which could
I have been trying to setup git for our web development team unsuccessfully. Some
I'm trying to setup the application server part of C2DM push messaging using this
I have spend all morning trying to set up multiple cores on a SOLR
Trying to setup my laptop to edit and run my C# application which called
In trying to setup a unit test for inserting an item into an SQL
Trying to setup a simple Thread/Poll table mapping. Here is what I have: Threads
Trying to setup plone2pdf in Plone 4. I have downloaded the Plone2pdf archive, extracted
Trying to setup a server on Rackspace.com. Have done the following things: Installed Centos
im trying to setup two listeners for one button. Here is my code: This

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.