rderik / shanti_kmaps_typeahead

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KMaps Typeahead

This repository contains a JQuery plugin which allows SHANTI's KMaps Solr index to be searched using Typeahead plug-in.

Please visit the project's documentation for examples and use cases.

Basic usage

Markup:

  <input type="text" id="kmaps-search-source" class="kmaps-search-term form-control form-text text-full" placeholder="Search source by text..." autocomplete="off">

Script

$("#kmaps-search-source").kmapsTypeahead({
    term_index: "URL_SOLR_TERM_INDEX",
    domain: "sources",
    filters_domain: "subjects",
    root_kmap_path: null,
    features_path: "HTTPS://PATH/TO/NODE/%%ID%%", //This base URL is a pattern with the %%ID%% to be replaced with each node's ID
    autocomplete_field: "title",
    filters: "asset_type:sources"
  });
  $("#kmaps-search-source").bind('typeahead:select', function(ev, suggestion) {
  console.log('Selection: ' + JSON.stringify(suggestion));
  $("#citation_info_source_id").val(suggestion.id);
});

About

License:GNU Affero General Public License v3.0


Languages

Language:JavaScript 96.2%Language:CSS 3.8%