IndexerElement

IndexerElement is a plain object which has a following properties:

  • id String - An identifier (should be unique), used as argument of execute function (optional, default is undefined)
  • payload Any - Extra payload, used as a argument of execute function (optional, default is undefined)
  • primaryText String - Primary text (required)
  • secondaryText String - Secondary text (optional)
  • icon String - Icon URL, See Icon URL Format (optional, default is icon of package.json)
  • redirect String - Redirection query (optional, default is undefined)
  • group String - Result group name (optional, default is undefined)

IndexerElement is used for synchronous searching items.
Both primaryText and secondaryText are used for user query matching.
primaryText has high-priority. secondaryText has lower-priority.

Example

...
const indexer = pluginContext.indexer;

function startup() {
  const indexerElement = {
    id: 'unique_value',
    primaryText: 'Hello, World',
    secondaryText: 'This is hello world description'
  };
  indexer.set('any-key', [indexerElement]);
}

...