Oracle Ultra Search provides a command-line tool to load metadata into an Oracle Ultra Search database. If you have a large amount of data, then this is probably faster than using the HTML-based administration tool.
The loader tool supports the following types of metadata:
Document relevancy boosting and document loading
The metadata loader is a Java application. To use the program, you must put the metadata in an XML file that conforms to the XML schema formats described in the following sections. You then can launch the Java program with the XML filename, the database related parameters, and the loader type parameter. The program parses the XML file and uploads the metadata. Status and error messages are displayed in the terminal console.
The loader program binary file is located in the following directory: %ULTRASEARCH_HOME%/bin/MetaLoader
.class
.
Your computer should have Java 1.2 compliant Java Runtime or higher. The following Java libraries should be included in the system Java CLASSPATH:
Oracle JDBC Thin Driver version 1.2. The filename is classes12
.zip
.
Oracle XML parser for Java version 2. The filename is xmlparserv2
.jar
.
Oracle XML schema processor for Java. The filename is xschema
.jar
.
Oracle Ultra Search Java library. The filename is ultrasearch
.jar
.
Oracle JDBC globalization support version 1.2. The filename is nls_charset12
.zip
.
Also include the path for Oracle Ultra Search binary files in the system Java CLASSPATH: %ULTRASEARCH_HOME%/bin
on UNIX or %ULTRASEARCH_HOME%\bin
on Windows.
To launch the file, enter the following:
% java MetaLoader -db database_connection_string -u user_name -p password -i instance_name -type loader_type -f input_file
Where:
-db
is the database connection string
-u
is the database schema user name
-p
is the database schema password
-i
is the Oracle Ultra Search instance name
-type
is the loader metadata type:lov or doc
-f
is the input metadata XML filename
For example, suppose you use the tool to load attribute LOVs specified in the XML file test
.xml
with the following arguments:
Database connection string: dlsun576:5521:isearch
Schema user name: wk_test
Schema password: welcome
Oracle Ultra Search instance name: wk_inst
The following statement launches the loader program:
% java MetaLoader -db dlsun576:5521:isearch -u wk_test -p welcome -i wk_inst -type lov -f test.xml
To use the loader tool to add documents and their relevancy boosting scores into Oracle Ultra Search, the parameter -type
value should be doc.
The document URL and relevance boosting scores are defined in an XML file. You can define one or more documents to be boosted. Each document can have one or more boosting score pairs. The definition of the XML file is stored in the XML schema.
<?xml version = "1.0" encoding = "UTF-8"?> <doc_list> <doc url="http://www.oracle.com" data_source_name="Data Source A"> <term score="100">database</term> <term score="90">internet</term> <term score="80">software</term> </doc> <doc url="http://www-st.us.oracle.com" data_source_name="Data Source B"> <term score="100">Sever Technology</term> <term score="100">ST Web site</term> <term score="95">st</term> </doc> </doc_list>
In the previous example, the document URL http://www.oracle.com
is loaded to the data source Data Source A. This is defined in Oracle Ultra Search with relevance boosting term database and score 100, term internet and score 90, term software and score 80.
Note: The data source name is the original data source name, not the data source display name. |
To use the loader tool to add LOV entries and display names to Oracle Ultra Search, the parameter -type value should be lov.
The LOV entries and display names are defined in a XML file. You can define one or more search attribute LOVs in the XML file. Both default LOV and data source-specific LOVs are put in the XML file. The definition of the XML file is stored in the XML schema.
<?xml version = "1.0" encoding = "UTF-8"?> <lov_list> <lov search_attr_name="Department" search_attr_type="string"> <default> <lov_values> <entry value="100"></entry> <entry value="200"></entry> </lov_values> <lov_display_names lang="en-US"> <entry value="100" display_name="Human Resource"></entry> <entry value="200" display_name="Finance"></entry> </lov_display_names> </default> <data_source name ="data source a"> <lov_values> <entry value="300"></entry> <entry value="400"></entry> </lov_values> <lov_display_names lang="en-US"> <entry value="300" display_name="Sales"></entry> <entry value="400" display_name="Marketing"></entry> </lov_display_names> </data_source> <data_source name ="data source b"> <lov_values> <entry value="500"></entry> <entry value="600"></entry> </lov_values> <lov_display_names lang="en-US"> <entry value="500" display_name="Production"></entry> <entry value="600" display_name="Research"></entry> </lov_display_names> </data_source> </lov> </lov_list>
In the previous example, several LOVs for the string type search attribute Department are loaded to Oracle Ultra Search. They are:
Default LOV entries for search attribute Department
Search attribute Department LOV for data source data source a
Search attribute Department LOV for data source data source b
The XML schema for document relevance boosting terms and scores are described as follows:
<?xml version = "1.0" encoding = "UTF-8"?> <!--Generated by XML Authority. Conforms to w3c http://www.w3.org/2001/XMLSchema--> <xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema" elementFormDefault = "qualified"> <xsd:element name = "doc_list"> <xsd:complexType> <xsd:sequence> <xsd:element name = "doc" maxOccurs = "unbounded"> <xsd:complexType> <xsd:sequence> <xsd:element name = "term" maxOccurs = "unbounded"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base = "xsd:string"> <xsd:attribute name = "score" use = "required" type = "xsd:integer"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> </xsd:sequence> <xsd:attribute name = "url" use = "required" type = "xsd:string"/> <xsd:attribute name = "data_source_name" use = "required" type = "xsd:string"/> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema>
The XML schema for LOV entries and display names are described as follows:
<?xml version = "1.0" encoding = "UTF-8"?> <!--Generated by XML Authority. Conforms to w3c http://www.w3.org/2001/XMLSchema--> <xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema" elementFormDefault = "qualified"> <xsd:element name = "lov_list"> <xsd:complexType> <xsd:sequence> <xsd:element name = "lov" maxOccurs = "unbounded"> <xsd:complexType> <xsd:sequence> <xsd:element name = "default" minOccurs = "0"> <xsd:complexType> <xsd:sequence> <xsd:element name = "lov_values" minOccurs = "0"> <xsd:complexType> <xsd:sequence> <xsd:element name = "entry" maxOccurs = "unbounded"> <xsd:complexType> <xsd:attribute name = "value" use = "required" type = "xsd:string"/> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name = "lov_display_names" minOccurs = "0" maxOccurs = "unbounded"> <xsd:complexType> <xsd:sequence> <xsd:element name = "entry" maxOccurs = "unbounded"> <xsd:complexType> <xsd:attribute name = "value" use = "required" type = "xsd:string"/> <xsd:attribute name = "display_name" use = "required" type = "xsd:string"/> </xsd:complexType> </xsd:element> </xsd:sequence> <xsd:attribute name = "lang" use = "required"> <xsd:simpleType> <xsd:restriction base = "xsd:string"> <xsd:length value = "5"/> <xsd:pattern value = "[a-zA-Z]{2}\-[a-zA-Z]{2}"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name = "data_source" minOccurs = "0" maxOccurs = "unbounded"> <xsd:complexType> <xsd:sequence> <xsd:element name = "lov_values" minOccurs = "0"> <xsd:complexType> <xsd:sequence> <xsd:element name = "entry" maxOccurs = "unbounded"> <xsd:complexType> <xsd:attribute name = "value" use = "required" type = "xsd:string"/> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name = "lov_display_names" minOccurs = "0"> <xsd:complexType> <xsd:sequence> <xsd:element name = "entry" maxOccurs = "unbounded"> <xsd:complexType> <xsd:attribute name = "value" use = "required" type = "xsd:string"/> <xsd:attribute name = "display_name" use = "required" type = "xsd:string"/> </xsd:complexType> </xsd:element> </xsd:sequence> <xsd:attribute name = "lang" use = "required"> <xsd:simpleType> <xsd:restriction base = "xsd:string"> <xsd:length value = "5"/> <xsd:pattern value = "[a-zA-Z]{2}\-[a-zA-Z]{2}"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:complexType> </xsd:element> </xsd:sequence> <xsd:attribute name = "name" use = "required" type = "xsd:string"/> </xsd:complexType> </xsd:element> </xsd:sequence> <xsd:attribute name = "search_attr_name" use = "required" type = "xsd:string"/> <xsd:attribute name = "search_attr_type" use = "required"> <xsd:simpleType> <xsd:restriction base = "xsd:string"> <xsd:enumeration value = "string"/> <xsd:enumeration value = "number"/> <xsd:enumeration value = "date"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema>