Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Overview

This API allows you to create a field in Hawksearch dashboard and manage the field configurations.

Example use case: Create a Brand field that can be used as a facet filter.

...

Expand
Code Block
languagejson
POST /api/v10/field HTTP/1.1
Host: managedashboard-na.hawksearch.com
X-HawkSearch-ApiKey: USE_YOUR_API_KEY
Cache-Control: no-cache
Postman-Token: cd457184-4c00-a650-62f2-530f22a9a384

{
    "FieldId": 0,
    "SyncGuid": "00000000-0000-0000-0000-000000000000",
    "Name": "brand",
    "FieldType": "facet",
    "Label": "Brand",
    "Type": "String",
    "Boost": 1,
    "FacetHandler": 0,
    "IsPrimaryKey": false,
    "IsOutput": true,
    "IsShingle": false,
    "IsBestFragment": false,
    "IsDictionary": false,
    "IsSort": false,
    "IsPrefix": false,
    "IsHidden": false,
    "IsCompare": false,
    "SortOrder": 0,
    "PartialQuery": "",
    "IsKeywordText": true,
    "IsQuery": false,
    "IsQueryText": false,
    "SkipCustom": false,
    "StripHtml": false,
    "MinNGramAnalyzer": 2,
    "MaxNGramAnalyzer": 15,
    "CoordinateType": 0,
    "OmitNorms": false,
    "ItemMapping": "",
    "DefaultValue": "",
    "UseForPrediction": false,
    "CopyTo": "",
    "Analyzer": "",
    "DoNotStore": false,
    "Tags": "",
    "Iterations": [
        1
    ],
    "AnalyzerLanguage": "",
    "PreviewMapping": null,
    "OmitTfAndPos": false,
    "CreateDate": "02-04-2021",
    "ModifyDate": "02-04-2021"
}

...

2. Please make sure that the field ‘Name’ is unique and a field with the same name does not exist already. You can first get a list of all fields using ‘/api/v9/FieldInfo’ or get this particular field information using field name 'api/v9/Field?fieldName={fieldName}' before creating a new field

...

3. The ‘Fieldtypecan only have one of the 4 possible values (refer to Best Practices section below):

...

  1. Multiple fields can have the same ‘Label’ value as long as the Name is unique.

  2. Boost has to be set to 1 when IsQuery=false

  3. IsPrimaryKey should be always set to ‘false’ unless you want to mark that field as a Primary Key. Note that only one field can be a Primary key and it is suggested to NOT change it often as it might have a negative impact on site functionality. Please contact Hawksearch if you would like to change the Primary key.

  4. IsOutput should be set to ‘true’ only if you need the field value in the search response. Please always set it to ‘false’ if not in use.

  5. IsShingle corresponds to Add phrases to "Did you Mean"? under the field settings on the dashboard. It has to be set to false when IsQuery=false.

  6. If IsQuery=true, then IsShingle can be set to true only for "Type": "string". You can not use it for types ‘Numeric’ or ‘Boolean’.

  7. If IsQuery=true, then IsShingle can be set to true only for "FieldType": "facet", “keyword” and ”keywordtext”. You can not use it for field types ‘unindexed’, ‘text’.

    {keyword, "Field values indexed ""as is"" AND are stemmed"} >> “IsKeywordText will be set to 1” ,
    {keyword, "Field values are NOT stemmed"}>> “IsKeywordText will be set to 0”,
    {text, "Field values are ONLY stemmed (search only)"},
    {unindexed, "Stored only, not used for search nor facets"},
    {facet, "Field values are NOT stemmed"}} >> The field type value changes to ‘facet’ from ‘keyword’ if you set up this field as a facet. For fields that will be used as facet, please set up field type as ‘facet’.

  8. Iterations can be skipped from the request but if IsQuery=true, IsShingle = true then we need to set the Iterations value by default to 1.

  9. Type is the datatype of the field. One of the 3 possible values is String, Single, Boolean. If you set a field as IsQuery=true and IsShingle = true then you need to always pass the Type information in the request as IsShingle cannot be used for types ‘Numeric’ or ‘Boolean’.

  10. SortOrder field is optional and can be passed if you would like to maintain a specifc order for all the field values. The value should always be numeric.

...