XML DB Connector
Setting up XML DB Connector
Create a Database Collection in SearchBlox
- Access Collection Creation
Log in to the SearchBlox Admin Console
Go to the Collections tab
Click either:
Create a New Collection button, or
The "+" (plus) icon in the collections panel - Configure Collection Type
Choose "Database Collection" from the list
This allows the system to connect with XML databases - Define Collection Properties
Collection Name: Enter a unique name (example: XML_Products)
Access Control:
Choose:
Private – only selected users can access
Public – everyone can access
Security: Enable/disable depending on how sensitive the data is
Language:
Default is English
Select another language if your content is in a different language - Finalize Creation
Click Save to create the collection
A confirmation message will appear after successful creation

XMLSample Data
The sample XML file is used to set up SQL queries and database connection URLs.
Steps to Test the DB Connector:
Download the XML file.
Save it in the required folder.
Follow the given instructions to check whether the DB connector is working properly.
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<rootAttr1>rootValue1</rootAttr1>
<people>
<personal>
<age>20</age>
<gender>M</gender>
<name>
<first>John</first>
<last>Doe</last>
</name>
</personal>
<jobs>support</jobs>
<jobs>coding</jobs>
<vehicles>
<type>car</type>
<model>Honda Civic</model>
<insurance>
<company>ABC Insurance</company>
<policy_num>12345</policy_num>
</insurance>
<features>sunroof</features>
<features>rims</features>
<maintenance>
<date>07-17-2017</date>
<desc>oil change</desc>
</maintenance>
<maintenance>
<date>01-03-2018</date>
<desc>new tires</desc>
</maintenance>
</vehicles>
<vehicles>
<type>truck</type>
<model>Dodge Ram</model>
<insurance>
<company>ABC Insurance</company>
<policy_num>12345</policy_num>
</insurance>
<features>lift kit</features>
<features>tow package</features>
<maintenance>
<date>08-27-2017</date>
<desc>new tires</desc>
</maintenance>
<maintenance>
<date>01-08-2018</date>
<desc>oil change</desc>
</maintenance>
</vehicles>
<addresses>
<type>work</type>
<zip>12345</zip>
</addresses>
<addresses>
<type>home</type>
<zip>12357</zip>
</addresses>
<source>internet</source>
</people>
<people>
<personal>
<age>24</age>
<gender>F</gender>
<name>
<first>Jane</first>
<last>Roberts</last>
</name>
</personal>
<jobs>sales</jobs>
<jobs>marketing</jobs>
<source>phone</source>
<vehicles>
<type>car</type>
<model>Toyota Camry</model>
<insurance>
<company>Car Insurance</company>
<policy_num>98765</policy_num>
</insurance>
<features>upgraded stereo</features>
<maintenance>
<date>05-11-2017</date>
<desc>tires rotated</desc>
</maintenance>
<maintenance>
<date>11-03-2017</date>
<desc>oil change</desc>
</maintenance>
</vehicles>
<vehicles>
<type>car</type>
<model>Honda Accord</model>
<insurance>
<company>Car Insurance</company>
<policy_num>98765</policy_num>
</insurance>
<features>custom paint</features>
<features>custom wheels</features>
<maintenance>
<date>10-07-2017</date>
<desc>new air filter</desc>
</maintenance>
<maintenance>
<date>01-13-2018</date>
<desc>new brakes</desc>
</maintenance>
</vehicles>
<addresses>
<type>home</type>
<zip>98765</zip>
</addresses>
<addresses>
<type>work</type>
<zip>98753</zip>
</addresses>
</people>
<rootAttr2>rootValue2</rootAttr2>
<rootAttr3>rootValue3</rootAttr3>
<rootAttr3>rootValue4</rootAttr3>
</root>
- The main element in this XML file is people.
- The structure of objects in the file is represented in the following table.
Learn more on Parsing XML Data

JSON Objects in the file
Database Collection Settings
Essential Configuration Parameters
- Database Type Selection
Step: Open the Database Type dropdown menu
Action: Select "XML" as the database type
Purpose: This allows the system to properly read, process, and index XML data - Select XML as the database type from the dropdown menu.
- Enter the Database URL String in the required format (as shown in the example).
-
jdbc:xml:DataModel=Relational;URI=file_path.xml - Enter the exact URI (path or location) of your XML file.
- Enter the SQL query that will read the data from the XML file and store it.
-
SELECT * FROM xml_document

- Click Save to store your settings.
- Click Test Database Collection to verify the setup.
The database connection must be successful for indexing to work properly.
Configure SQL Query
- To get data from the XML file, you must provide a SELECT SQL query.
- You must map a unique field to uid (this is required).
- The query should follow SQL SELECT query format with mappings. SQL Query for Database Collection
SELECT <index field> as uid , <column name2> as title, <column name3> as content FROM <tablename> LIMIT 100
- n the above query, the fields are shown using a hierarchical structure for example:
[people].[personal.name.first] [people].[vehicles.maintenance.date]Reference for select queries for Database XML Connector
- If your table has more than 100 records, use the LIMIT option in your query to control how many documents are indexed.
Example:Otherwise, a minimum of 50 rows will be indexed.SELECT <index field> as uid , <column name2> as title, <column name3> as content FROM <tablename> LIMIT 100

Schedule and Index
This setting lets you choose when and how often a collection should be indexed.
Schedule Frequency options available in SearchBlox:
Once
Hourly
Daily
Every 48 Hours
Every 96 Hours
Weekly
Monthly
The following actions are available for Database Collections:
| Action | Description |
|---|---|
| Schedule | You can set up automatic indexing for each collection using the options above. |
To know more about Database Collection refer Database Collection

Search results in faceted search is shown here:



Updated 4 days ago
