Contents
Importing Data into the Knowledge Center Server
Indexer Tool
If you are not going to use a CMS you can use the indexer to import data for use with Genesys Knowledge Center. The indexer is installed during the installation of Knowledge Center Server. It is located inside your Knowledge Center Server installation folder in the \server\tools\indexer subdirectory.
Command line:
java -jar indexer.jar [parameters]
Parameters:
Short Parameter | Qualified Parameter | Mandatory | Example | Description |
---|---|---|---|---|
-u | --user | n/a | --user gkc_super | Name of internal user with authoring permissions |
-a | --authorization | n/a | -a user:password | Username and password for basic authorization |
-author | --author | n | --author gks_super | (introduced in 9.0.002.09) Common author identifier for all documents that are being published |
-approver | --approver | n | --approver gks_super | (Introduced in 9.0.002.09) Common approver identifier for all documents that are being published |
-f | --file | Y | --file c:\xml | Path to file or directory with files for importing |
-h | --host | Y | --host http://gks/gks-server:8080 | target knowledge server url |
-o | --overwrite | n/a | -o | For replacing all existing documents with documents from importing file |
-tenant | --tenantId | n/a | --tenantId 1 | Target tenant identifier |
-sbt | --subTenantId | n/a | --subTenantId default | Target subtenant identifier |
-sk | --ssIKeys | n/a | --sslKeys c:\keys\sslkey | Path to trust store |
-sp | --ssIPassword | n/a | --sslPassword topsecret | trust store password |
-t | --transformer | n/a | --transformer c:\transformers\transformer.xsl | Path to XSL transformer |
Knowledge File Structure
field | type | mandatory | format | description |
---|---|---|---|---|
knowledge | Object | Y | n/a | Container of documents and categories for indexing. There are two mandatory attributes of a node of "knowledge":
|
knowledge.categories | Array | N | n/a | Knowledge base categories directory |
knowledge.categories[].category | Object | Y | n/a | Knowledge category |
knowledge.categories[].category.id | String | Y | n/a | Category identifier |
knowledge.categories[].category.categoryParentId | String | N | n/a | Parent category identifier. Omit for root categories. |
knowledge.categories[].category.name | String | Y | n/a | Category name |
knowledge.documents | Arrray | N | n/a | Documents for indexing. Omitting of this field means that indexer must not touch already indexed documents at all. |
knowledge.documents[].id | String | N | n/a | Document identifier. Server may generate identifier automatically in case when documents[].id is omitted |
knowledge.documents[].templateId | String | Y | n/a | Document template identifier |
knowledge.documents[].author | String | No | n/a | (Introduced in 9.0.002.09) Document author |
knowledge.documents[].approver | String | No | n/a | (Introduced in 9.0.002.09) Document approver |
knowledge.documents[].validFrom | Date | N | YYYY-MM-DD | Document start date |
knowledge.documents[].validTo | Date | N | YYYY-MM-DD | Document expiration date |
knowledge.documents[].media | Array | N | n/a | List of media channels that this document is related to. |
knowledge.documents[].media.media | String | N | n/a | Document media channel value |
knowledge.documents[].tags | Array | N | n/a | List of tags related to this document |
knowledge.documents[].tags.tag | String | Y | n/a | Document tag value |
knowledge.documents[].url | String | N | n/a | Document external url |
knowledge.documents[].title | String | Y | n/a | Document title |
knowledge.documents[].title.id | String | Y | n/a | Document title name |
knowledge.documents[].title.value | String | Y | n/a | Document title value |
knowledge.documents[].content | Array | Y | n/a | Document content |
knowledge.documents[].content[].docField | Object | Y | n/a | Document content field |
knowledge.documents[].content[].docField.id | String | Y | answer, description, body | Document content field name |
knowledge.documents[].content[].docField.value | String | Y | n/a | Document additional content field value Important For importing Rich Text in HTML format via indexer use <![CDATA[ and ]]> tags inside <value> field. |
knowledge.documents[].additional | Array | N | n/a | Document additional content |
knowledge.documents[].additional[].docField | String | Y | n/a | Document additional content field |
knowledge.documents[].additional[].docField.id | String | Y | n/a | Document additional content field name |
knowledge.documents[].additional[].docField.value | String | Y | n/a | Document additional content field value Important For importing Rich Text in HTML format via indexer use <![CDATA[ and ]]> tags inside <value> field. |
knowledge.documents[].alternatives | Array | N | n/a | Alternative names/questions for the document |
knowledge.documents[].alternatives[].alternative | String | N | n/a | Relevant text item |
knowledge.documents[].attachments | Array | N | n/a | Document attachments |
knowledge.documents[].attachments[].attachment | String | N | n/a | Document attachment URL |
knowledge.documents[].categories | Array | N | n/a | Document category identifiers |
knowledge.documents[].categories[].category | Object | N | n/a | Document category object |
knowledge.documents[].categories[].category.id | String | Y | n/a | Document category identifier |
knowledge.documents[].customFields | Array | N | n/a | Document custom attributes |
knowledge.documents[].customFields[].entry | Object | N | n/a | Document custom attribute item |
knowledge.documents[].customFields[].entry.key | String | Y | n/a | Document custom attribute name |
knowledge.documents[].customFields[].entry.value | VAR | N | n/a | Document custom attribute value |
Example of content of indexing file (v2)
<?xml version="1.0" encoding="UTF-8"> <knowledge kbId="knowledgefaq" lang="en" version="8.5.304"> <categories> <category> <id>c1</id> <name>category 1</name> </category> <category> <id>c2</id> <name>category 2</name> <categoryParentId>c1</parentId> </category> </categories> <documents> <document> <id>doc1</id> <templateId>basefaq</templateId> <validFrom>2017-02-20</validFrom> <validTo>2017-02-21</validTo> <media> <media>m1</media> <media>m2</media> </media> <tags> <tag>t1</tag> <tag>t2</tag> </tags> <url>doc1url</url> <title> <id>question</id> <value>document question</value> </title> <content> <docField> <id>answer</id> <value>answer body</value> </docField> </content> <alternatives> <alternative>document alt1</alternative> <alternative>document alt2</alternative> </alternatives> <attachments> <attachment>a1</attachment> <attachment>a2</attachment> </attachments> <categories> <category><id>c1</id></category> <category><id>c2</id></category> </categories> <customFields> <entry> <key>strField</key> <value>some string</value> </entry> <entry> <key>numField</key> <value>123</value> </entry> </customFields> </document> <document> <id>doc2</id> <templateId>basefaq</templateId> <validTo>2017-02-21</validTo> <media> <media>m1</media> <media>m2</media> </media> <tags> <tag>t1</tag> <tag>t2</tag> </tags> <url>doc2url</url> <title> <id>question</id> <value>document question</value> </title> <content> <docField> <id>answer</id> <value>faq answer</value> </docField> </content> <alternatives> <alternative>document alt1</alternative> <alternative>document alt2</alternative> </alternatives> <attachments> <attachment>a1</attachment> <attachment>a2</attachment> </attachments> <categories> <category><id>c1</id></category> <category><id>c2</id></category> </categories> <customFields> <entry> <key>strField</key> <value>some string</value> </entry> <entry> <key>numField</key> <value>123</value> </entry> </customFields> </document> <document> <id>doc3</id> <templateId>basearticle</templateId> <media> <media>m1</media> </media> <title> <id>title</id> <value>document title</value> </title> <content> <docField> <id>description</id> <value></value> </docField> </content> <additional> <docField> <id>summary</id> <value>document summary</value> </docField> </additional> <customFields> <entry> <key>cf1</key> </entry> </customFields> </document> </documents> </knowledge>
Importing Sample Data
In the ./server/tools directory in the Knowledge Center installation folder, you can find a sample knowledge base along with the indexer tool:
- knowledgeFAQ.xml — Sample knowledge base describing some of the questions related to Knowledge Center
- indexer.jar—Java-based indexing tool
- importFAQ.bat—Simple data import script
To import a sample knowledge base you need to:
- open import.bat file:
- ensure that --host parameter is pointing on one of your Knowledge Center Servers or the load balancer in front of the cluster (recommended)
- ensure that --user parameter is set to valid used with Knowledge.AUTHOR privileges (knowledge by default)
- save changes if any
- open knowledgeFAQ.xml:
- ensure that kbId attribute is set to desired knowledge base you would like to import data to (knowledgeFAQ by default)
- ensure that language is set to properly configured one and added to the knowledge base
- save changes if any
- run import.bat