Versions Compared

Key

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

...

Hawksearch Versions: Hawksearch V4v4.0. Additional implementation changes might be needed to use this feature.

Note: Geolocation Search feature is already available for Hawksearch v4.0L clients. Please contact your Client Success Director for details and implementation.

Search: Dashboard Configuration

We have added a new range facet option - a Distance facet type which allows our customers to narrow down a list of results and sort them by distance within a chosen range. Your site visitors can now search by a zip code and get back list of relevant search results. This functionality will allow them to see the store location/products available in the physical location closest to them.

Fields

The first step to setting up Geolocation Search is to add a location field to your attribute.txt file and add a Location field under Workbench → Data Configuration → Fields. Make sure that this field is saved as a GeoPoint Value as shown below:

...

Once the field is set up, the next step is adding a Distance facet.

Facets

Distance facet falls under the Range facet type. A Location field needs to be passed to Hawksearch in feeds. Use the following configuration to set up a Geolocation Search facet:

...

More information about setting up Facets can be found here.

Setting Up Sorting Set for Distance Facet

Geolocation Search should be set up as a separate sorting set as it will only apply when a user is searching by zip code.

...

For more information, please follow instructions on sorting sets refinement: Sorting/Pagination

Implementation Details

Note: Please review this article if you are not sure where to find your client guid.

Indexing Geo Location

Attribute file must contain latitude and longitude information for each item.

...

Expand
titleExample:

Code Block
{

    "IndexName": "XXXXXXXXXXXXXXXX",

    "Items": [

        {

            "id": [

                "1"

            ],

            "title": [

                "Testing Geo"

            ],

            "location": [

                {

                    "lat": "42.09975", //Chicago coordinates

                    "lon": "-87.7809"

                }

            ]

//other attributes

        }

    ]

}

Searching within a Radius

Sorting Sets

Example:

Expand
titleExample
Code Block
"Sorting": {
        "Items": [
            {
                "Label": "Nearest",
                "Value": "Nearest",
                "IsDefault": true,
                "Selected": false
            },
            {
                "Label": "Farthest",
                "Value": "Farthest",
                "IsDefault": false,
                "Selected": true
            }
        ]
    }

...

Expand
title Example
Code Block
"Results": [

        {

            "DocId": "2",

            "Score": 2.0,

            "Document": {

                "id": [

                    "2"

                ],

                "title": [

                    "Testing GeoLocation Rockford, Il"

                ],

                "location": [

                    {

                        "lon": -89.064445,

                        "lat": 42.259445

                    }

                ],

                "title_test_copy": [

                    "Testing GeoLocation Rockford, Il"

                ]

            },

            "BestFragments": {

                "title": "Testing GeoLocation Rockford, Il"

            },

            "IsPin": false,

            "IsVisible": true

        },

        {

            "DocId": "1",

            "Score": 2.0,

            "Document": {

                "id": [

                    "1"

                ],

                "title": [

                    "Testing GeoLocation Chicago"

                ],

                "location": [

                    {

                        "lon": -87.7809,

                        "lat": 42.09975

                    }

                ],

                "title_test_copy": [

                    "Testing GeoLocation Chicago"

                ]

            },

            "BestFragments": {

                "title": "Testing GeoLocation Chicago"

            },

            "IsPin": false,

            "IsVisible": true

        },

        {

            "DocId": "3",

            "Score": 2.0,

            "Document": {

                "id": [

                    "3"

                ],

                "title": [

                    "Testing GeoLocation Kenosha, WI"

                ],

                "location": [

                    {

                        "lon": -87.822899,

                        "lat": 42.588081

                    }

                ],

                "title_test_copy": [

                    "Testing GeoLocation Kenosha, WI"

                ]

            },

            "BestFragments": {

                "title": "Testing GeoLocation Kenosha, WI"

            },

            "IsPin": false,

            "IsVisible": true

        },

        {

            "DocId": "4",

            "Score": 2.0,

            "Document": {

                "id": [

                    "4"

                ],

                "title": [

                    "Testing GeoLocation Paris"

                ],

                "location": [

                    {

                        "lon": 2.349014,

                        "lat": 48.864716

                    }

                ],

                "title_test_copy": [

                    "Testing GeoLocation Paris"

                ]

            },

            "BestFragments": {

                "title": "Testing GeoLocation Paris"

            },

            "IsPin": false,

            "IsVisible": true

        }

    ],

…

Tracking for Reporting

Even though the API request contains latitude and longitude, we have a mode where you can also pass a zip code in for tracking purposes. It is important to pass zip code in the object shown below if you are looking to see reporting around geolocation search. If zip code is not passed, no data will be tracked.

...

Please note that zip codes that were searched for will appear in the Keyword column within Hawksearch Search reports.

Best Practices

As a best practice we recommend to use this facet for searches under 250 miles radius for performance reasons. If you are looking to pull in results for a larger radius or see all possible results, a different approach may need to be chosen. Please reach out to our Support or Client Success Directors teams should you have questions.