Kentico: File Export overview

In this article you’ll find:

Goal

The purpose of this article is to show you how to configure the File Export indexing.

The main purpose of the file export:

Hawksearch can work on the following two environments: Elastic and Lucene. The exporter takes a major role in the second one. Тo index the items that we want the customer to search through, we need first to export in separate files the whole information about these content types and records. This information must then be uploaded and indexed so it can be visible on the page where the Hawksearch search result widget is placed.

Prerequisites

Configured connector - Kentico: System Settings Setup

Steps to configure File Export settings

  1. From the application selector side menu (F2 or button top left) choose the Settings application.

  2. Go to Integration / Hawksearch and make sure under Indexing settings the Indexing type is set to File Export.

  3. On the same page you’ll find the File Export settings under the category File Export settings.

  4. Build Landing Pages - Whether landing pages will be built.

  5. Landing Pages Base Path - The base path for landing page urls, added as a prefix to the landing page url while generating landing pages if that feature is enabled.

  6. Output Path - This path is relative to the CMS project folder. This is where the Hawksearch feed files will be generated at, e.g. /HawksearchFeed. Make sure that this folder exists beforehand.

  7. Item types - a semicolon separated list of page / module class code names, used to determine what gets included in the items.txt file.

  8. Attribute types - a semicolon separated list of page / module class code names, used to determine what gets included in the attributes.txt file.

  9. Content types - a semicolon separated list of page / module class code names, used to determine what gets included in the content.txt file.

  10. Hierarchy types - a semicolon separated list of page / module class code names, used to determine what gets included in the hierarchy.txt file.

Creating items.txt mappings

  1. Open the application selector side menu (F2 or top left button) and go to Custom/Hawksearch.

  2. Expand the File Export and go to Items mapping.

  3. Click New item mapping.

  4. Choose the predefined field you want to make a mapping for. Some are optional, some are required for every item. The required ones are: Unique identifier, Name, URL to detail page, Image, Price retail, Price sale. You can also choose Add custom field which lets you define the Hawksearch field name as well.

  5. If you have chosen Url to detail page, you’ll see a checkmark for Use culture prefix which lets you append the culture prefix before the url.

  6. If you have chosen Add custom field, write the name of the field in the Field name text box. This needs to correspond to a field in Hawksearch.

  7. Destination field name - The database column name from which you want to obtain the value for this mapping.

  8. Type name - choose the type predefined in the settings that you want the mapping to be for.

  9. Is required - Is this mapping required. If it's required and it's missing a value from the Destination field name, the whole row will be skipped and not written to the text file.

  10. Click save.

Creating attributes.txt mappings

  1. Open the application selector side menu (F2 or top left button) and go to Custom/Hawksearch.

  2. Expand the File Export and go to Attributes mapping.

  3. Click New attribute mapping.

  4. Choose the Name of the mapping. Both Identifier & Data are required.

  5. Type - choose the type predefined in the settings that you want the mapping to be for.

  6. Use hierarchy map field - If Data is selected as name, this is available. If enabled, it will map the attribute with a hierarchy id field name for the Hawksearch field name.

  7. Hawksearch field name - The name of the field in Hawksearch.

  8. Destination field name - The database column name from which you want to obtain the value for this mapping.

  9. Use custom array data - If checked, the exporter will attempt to get the value from a class that you must have previously defined that inherits BaseInfo in some way (TreeNode for example inherits BaseInfo a few levels down) and implements the interface IHawksearchCustomData located in the namespace Hawksearch.Kentico.Xperience.CMS.Feeds.Contracts.

  10. Is reference field - The value of the field will be split by a semicolon and new attributes will be added for each split subvalue.

  11. Is required - Is this mapping required. If it’s required and it’s missing a value from the Destination field name, the whole row will be skipped and not written to the text file.

  12. Click save.

Creating content.txt mappings

  1. Open the application selector side menu (F2 or top left button) and go to Custom/Hawksearch.

  2. Expand the File Export and go to Content mapping.

  3. Click New content mapping.

  4. Choose the Name of the mapping. Some are optional and some are required. The required ones are: Identifier, Name & Url.

  5. Destination field name - The database column name from which you want to obtain the value for this mapping.

  6. If you have chosen Url, you’ll see a checkmark for Use culture prefix which lets you append the culture prefix before the url.

  7. Type - choose the type predefined in the settings that you want the mapping to be for.

  8. Is required - Is this mapping required. If it’s required and it’s missing a value from the Destination field name, the whole row will be skipped and not written to the text file.

  9. Click save.

Creating hierarchy.txt mappings

  1. Open the application selector side menu (F2 or top left button) and go to Custom/Hawksearch.

  2. Expand the File Export and go to Hierarchy mapping.

  3. Click New hierarchy mapping.

  4. Choose the Name column of the mapping. Some are optional and some are required. The required ones are: ID, Name, Parent ID.

  5. Destination field name - The database column name from which you want to obtain the value for this mapping.

  6. Type - choose the type predefined in the settings that you want the mapping to be for.

  7. Is required - Is this mapping required. If it’s required and it’s missing a value from the Destination field name, the whole row will be skipped and not written to the text file.

  8. Click save.

How to run an Export?

The export is run by the scheduled task that is added for each specific index. Kentico: Creating the Indexing Scheduled task .

Once you have added and configured the scheduled task, it will run automatically on the predefined timing that you have set. If you want to run it manually, find the created task and press the green play button in order to execute it now regardless of its scheduling settings.

After the task finishes, you can find your text files inside the folder that you have specified in the settings.