ACP Subobject - AFS

AFS Integration Guide

Product
AFS
AFS_Version
7.7
Category
Reference Guide

ACP enables users to quickly find and select from a pre-populated list of values as they type in the search field, leveraging searching and filtering. By entering something into the search field, the ACP starts searching for entries that match and displays a list of values to choose from. By entering more characters, the user can filter down the list to better matches.

ACP can be customized like so:

ACP Subobject

Parameter Name

Card

Type

Default

Description

enabled

Optional

Boolean

true

ACP is enabled by default provided the "acp" section is present.

Set enabled to false in order to temporarily disable the ACP (if you plan to reuse it later on). When there is no "acp" section, ACP is disabled.

lang

Optional

String

empty string

ISO639-1 language code

feeds

Optional

Object Array

[ ]

ACP Feed(s) we want to get suggestions of completion from. By default use all feeds available.

Each array item describes a feed, its fields name denotes the filename of the ACP feed without its suffix "_<lang>:acp.xml" (where <lang> denotes the ISO639-1 language code mentioned above).

If lang is empty (or not specified) the filename prefix ends with ":acp.xml" (Note there is no "_lang" in this case), title is used when more than one feed are displayed.

limit

Optional

Integer

10

maximum number of suggestions displayed per ACP feed (default is 10), 0 denotes all suggestions

minLength

Optional

Integer

2

The minimum number of characters a user has to type before the Autocomplete activates

delay

Optional

Integer

200

The delay in milliseconds the Autocomplete waits after a keystroke to activate itself. A zero-delay makes sense for local data (more responsive), but can produce a lot of load for the ACP web service, while being less responsive.

instantSearch

Optional

Boolean

false

Is instant search enabled?

mode

Optional

Enumeration (SIMPLE or CUSTOM)

SIMPLE

The ACP display mode. SIMPLE displays only one ACP list, CUSTOM enables to layout suggestions display through composite mechanism.

When instantSearch is enabled here, it replaces the instant search mode defined in the Keywords configuration. This instant search uses the first ACP suggestion to retrieve new results. Each entered character can induce new results, there is no need to configure a wildcard search here.

In the example below ACP is disabled as there is no "acp" section under Keywords.

<div class="AFSWidget" title="Keywords">
<script type="application/json">
{
}
</script>
</div>

Here is how to enable ACP equipped with its default configuration:

<div class="AFSWidget" title="Keywords">
<script type="application/json">
{
"acp": {
}
}
</script>
</div>

Here is how to configure ACP start displaying no more than 5 suggestions as soon as 3 characters are typed.

<div class="AFSWidget" title="Keywords">
<script type="application/json">
{
"acp": {
"limit": 5,
"minLength": 3
}
}
</script>
</div>

Now say you want to use only a subset of all available feeds, like for example the suggestions from the feeds named catalog and products. Here is the corresponding configuration:

<div class="AFSWidget" title="Keywords">
<script type="application/json">
{
"acp": {
"feeds": [
{"name": "catalog", "title": "Catalog"},
{"name": "products", "title": "Products"}
]
}
}
</script>
</div>

The below example above assumes the following files are present on the server side:

  • catalog:acp.xml
  • products:acp.xml

And what about multilingual ACP… As of today the Keywords Widget enforces a single ACP file naming convention on the server side. Depending on whether the lang is set or not, it is:

  • If the lang is set in Keywords.acp.lang:

feedName_lang:acp.xml

  • if lang is not set or set to an empty string

feedName:acp.xml

  • where:
    • feedName denotes a feed name (ie. Keywords.acp.feed.name)
    • lang denotes a ISO-639-1 language code (Note that when set it is prefixed with an underscore character ('_'))

I plan to add a way to configure the naming convention at a later date. But as of today, I invite you to stick to this fixed naming convention for your ACP files.

<div class="AFSWidget" title="Keywords">
<script type="application/json">
{
"acp": {
"lang": "fr",
"feeds": [
{"name": "catalog", "title": "Catalog"},
{"name": "products", "title": "Products"}
]
}
}
</script>
</div>

The below example above assumes the following files are present on the server side:

  • catalog_fr:acp.xml
  • products_fr:acp.xml

Uh-huh, … I really want to stick with my version 6 naming convention that goes like this

LANG:feedName:acp.xml

(e.g., FR:catalog:acp.xml and FR:products:acp.xml) but I absolutely want to use your amazing Keywords Widgets to show the suggestions. Would you have a workaround to make this work smoothly?

Ok, ok, I knew a question like this would arise at some point, and have a workaround ready. Here it is. Set Keywords.acp.lang to an empty string and Keywords.acp.feeds.name to the name of the feed without its ":acp.xml" suffix.

<div class="AFSWidget" title="Keywords">
<script type="application/json">
{
"acp": {
"lang": "",
"feeds": [
{"name": "FR:catalog", "title": "Catalog"},
{"name": "FR:products", "title": "Products"}
]
}
}
</script>
</div>