Site search API documentation

This search interface API documentation lists the available customizations and configurations for the JavaScript search interface. The engine uses a straightforward key/value configuration format. Make sure the parameters are set in the code block below:

  <script type="text/javascript">
    sitesearch(function(openindex) {
      openindex.<KEY> = <VALUE>
    });
  </script>
If you are using the deprecated openindex.js instead of the new sitesearch.js plugin the parameters are set in the code block below:

  <script type="text/javascript">
    document.addEventListener("DOMContentLoaded", function() {
      openindex.<KEY> = <VALUE>
    });
  </script>

Result widget options

openindex.result.defaultTitle

Default title for search results without a title field or fall-back in case no suitable title was detected.

  openindex.result.defaultTitle = "No title";

openindex.result.titleLength

Maximum length for a result title before it is truncated and appended with single character ellipsis (…). A value of -1 disables length checking.

  openindex.result.titleLength = 52;

openindex.result.removeFromTitle

A substring or regular expression that is to be removed from the title. It can remove common page title prefixes or suffixes.

  openindex.result.removeFromTitle = "";

openindex.result.fileNameAsTitleFor

Instructs the engine to use the file name as title when the original title matches one of the comma separated case-insensitive titles. This is especially useful if the engine extracts a default title from PDF documents.

  openindex.result.fileNameAsTitleFor = "new title,title,untitled";

openindex.result.icons

A list of possible icons for the various documents in the search result set. Each icon consists of a key/value pair of which the value is the icon URL. The key consists of another key/value pair of which the key is a field of the document and the value is the value for that field in the document. The icons that matches first is selected. Only the fields lang, host, type and cat are allowed. The icon's alt text is selected from the documents field value.

  openindex.result.icons =
  {
    "type:text/html" : "https://www.openindex.io/img/icons/text-html.png",
    "type:application/pdf" : "https://www.openindex.io/img/icons/application-pdf.png"
  };

openindex.result.defaultIcon

The default icon and alt text to use. If you do not need icons to be displayed you can set both openindex.result.icons and openindex.result.defaultIcon to false.

  openindex.result.defaultIcon =
  {
    url : "https://www.openindex.io/img/icons/openindex-green.png",
    alt : "Openindex"
  };

openindex.result.loader

Loader image to display while the search request is being processed. This image is appended to the oi-result div and has the oi-result-loader id. This is useful in cases where a search can take longer than 500ms to complete and you want to give feedback to your users.

  openindex.result.loader = "https://www.openindex.io/img/loader.gif"

openindex.result.scrollTop

Whether to scroll back up to the top of the text box after loading a new of filtered search results page. This is useful for longer result lists with a pager control at the bottom.

  openindex.result.scrollTop = true

openindex.result.scrollTopOffset

The offset in pixels of the text box to scroll back to. A negative number means above the text box.

  openindex.result.scrollTopOffset = -32;

openindex.result.showAddr

Whether or not to display the host name or URL. Valid values are breadcrumb, host or url, no value disables this feature. If enabled the address will be displayed between the title and the result snippet encapsulated in <cite> tags. The bread crumb value is taken from the microdata breadcrumb itemprop.

  openindex.result.showAddr = "";

openindex.result.addrLink

Whether the displayed host name, bread crumb or URL will be clickable.

  openindex.result.addrLink = false;

openindex.result.addrLength

The maximum length of the address before being truncated.

  openindex.result.addrLength = 64;

openindex.result.showImage

Whether to display an automatically extracted image in the result snippet. Images can be extracted from the page's og:image tag, a Microdata image item or somewhere from the within the content. The image is clickable and the thumbnail is served from our servers. Set to false to disable.

  openindex.result.showImage = true;

openindex.result.imageDefault

URL to a default image in case the result has no image. Disabled by default.

  openindex.result.imageDefault = null;

openindex.result.imageNoDuplicates

Whether to display duplicate images. Note, deduplication is based on URL, not image content at this time.

  openindex.result.imageNoDuplicates = false;

openindex.result.imageWidth

The width of the image. Images are automatically scaled or cropped proportionally.

  openindex.result.imageWidth = 100;

openindex.result.imageHeight

The height of the image. Images are automatically scaled or cropped proportionally.

  openindex.result.imageHeight = 75;

openindex.result.showTimeSince

Whether to show the time since a document was indexed or published.

  openindex.result.showTimeSince = true;

openindex.result.timeSinceFormat

The format to control how the time is displayed. The time is prepended to the snippet and encapsulated in time tags.

  openindex.result.timeSinceFormat = "%AMOUNT% %UNIT% ago";

openindex.result.timeSinceMapping

The mapping of time units. The value of each pair can be used for translation.

  openindex.result.timeSinceMapping =
  {
    "now" : "now",
    "today" : "today",
    "yesterday" : "yesterday",
    "seconds" : "seconds",
    "minutes" : "minutes",
    "hours" : "hours",
    "days" : "days",
    "weeks"  : "weeks",
    "months" : "months",
    "years" : "years"
  };

openindex.result.snippetSource

Controls the source of the snippet. By default the web page's extracted text is used and search keywords are highlighted. It is also possible to use a fixed text without highlighting by adding <meta name="oi-description" value="Your snippet.."/> to your HTML. Valid options are:

  • content use the extracted text with highlighted keywords
  • description use the text from the oi-description metadata field
  • hybrid same as description, but fallback to content if there is no description
  openindex.result.snippetSource = "content";

openindex.result.snippetSize

Controls the size of the highlighted result snippet. The snippet cannot be larger than 512 characters. This does not apply if your have openindex.result.snippetSource = "description";

  openindex.result.snippetSize = 192;

openindex.result.mm

Controls the Minimum-should-Match parameter. It determines, depending on the number of search keywords are present, how many terms must match before a document is returned. It defaults to more than two keywords require one less, more than five require two less, more than six requires ninety percent of the terms to match. Set to 0% if you want to support full OR-search. For full AND-search, set to 100%. There is also a more detailed description with examples.

  openindex.result.mm = "2<-1 5<-2 6<90%";

openindex.result.deduplicate

Switches online distributed fuzzy deduplication of search results. Disable if you do not want your search results to be deduplicated.

  openindex.result.deduplicate = true;

openindex.result.overRequestRatio

Determines the ratio the deduplicator uses for so-called over requesting. If you have a large amount of duplicates your first search results page may display less than 10 results, while there are more than 10 found in total. If this happens you should increase this value by a little until the result set returns to normal.

  openindex.result.overRequestRatio = 1.5;

openindex.result.fuzzynessThreshold

Determines the threshold before a document is deduplicated. A value of 1.0 means only exact duplicates are removed from the search result set. A value of 0.5 means results that share 50 % similarity are removed from the result set.

  openindex.result.fuzzynessThreshold = 0.9;

openindex.result.prefetch

The number of top results to prefetch. If enabled the top results are preloaded by supporting browsers that have this feature enabled. This is a significant speed improvement for users clicking the first few results. The prefetch is a regular HTTP request and leaves a log entry in web server logs even if the user hasn't visited the web page. Keep this option disabled if you don't want skewed log entries/statistics or (slightly) higher load. A value higher than 8 is not permitted.

  openindex.result.prefetch = 0;

openindex.result.dnsPrefetch

Whether to enable DNS prefetching. If enabled the DNS records of the various hosts that make up your search result are prefetched, improving speed when results are clicked. This is only useful if you have multiple hosts in your search index.

  openindex.result.dnsPrefetch = false;

openindex.result.followSingleResult

With this option enabled, the user is immediately redirected to the URL of the first result when there is exactly one result.

  openindex.result.followSingleResult = false;

openindex.result.autoStyle

The search result widget styles itself by default and should fit for most cases. The CSS rules are only added if no CSS rules on .oi-results or .oi-result are already defined.

  openindex.result.autoStyle = true;

openindex.result.template

Custom search result template function. Set this function if you want full control over how the search result is presented. If you do not use the passed URL parameter as source of the hyperlink, then clicks will not be measured. The default template function just concatenates all the important parts of HTML. You are free to any HTML you need. Keep in mind that some fields of the document object may not always be present, so check fields you want to use for presence.

  • doc document object
  • url this url must be used if you it to count in the analytics
  • title title to be shown, not neccesarily the HTML title
  • addr address line
  • snippet snippet text including time and image
  • links optional hyperlinks
  • rank rank of the search result
  openindex.result.template = function(doc, url, title, addr, snippet, links, rank) {
    return title + addr + snippet + links;
  };
      

openindex.result.boostPopularDocuments

If enabled, popular web pages are boosted.

  openindex.result.boostPopularDocuments = true;

Text input widget options

openindex.text.keydownCallback

Callback function to call when a keyDown event on the main input field occurs, the first parameter passed is the user's query and the second is the original event object. This function call is blocking, possible errors inside the callback function are caught in a try/catch block to prevent disruption of the search service. No logging is available.

  openindex.text.keydownCallback = function(q, e) { alert(q + e); };

openindex.text.keyupCallback

Callback function to call when a keyUp event on the main input field occurs, the first parameter passed is the user's query and the second is the original event object. This function call is blocking, possible errors inside the callback function are caught in a try/catch block to prevent disruption of the search service. No logging is available.

  openindex.text.keydownCallback = function(q, e) { alert(q + e); };

Suggest widget options

openindex.suggest.disabled

The autosuggest widget is enabled by default. The widget takes its input directly from previous search requests so it takes some time before it is populated. Set to true to disable the suggest widget.

  openindex.suggest.disabled = false;

openindex.suggest.autoStyle

The autosuggest widget styles itself by default and should fit for most cases. The CSS rules are only added if no CSS rules on .oi-suggestions or .oi-suggestion are already defined.

  openindex.suggest.autoStyle = true;

openindex.suggest.development

If this feature is enabled, the suggest engine uses dummy data to populate the suggestions. Useful for front-end developers styling the search engine.

  openindex.suggest.development = false;

openindex.suggest.trending

The search suggestions know if they are trending or not, based on historical data and current events. With this option enabled, new but trending suggestions can get a higher score than the usual popular suggestions. Valid values are 0 to 9 of which 0 disables trending suggestions. Higher values mean more weight to the trending score.

  openindex.suggest.trending = 1;

openindex.suggest.fuzzy

The amount of tolerated fuzzyness. If enabled, the suggest widget is more tolerant of spelling errors while typing.

  openindex.suggest.fuzzy = true;

openindex.suggest.rows

Instruct the search engine to return the specified number of suggestions. The minimum number of rows is 2, the maximum is 8.

  openindex.suggest.rows = 4;

openindex.suggest.showHits

Whether to show the number of hits for a suggestion. The value of this option is appended to the suggestion inside a span with class name oi-suggestion-hits. The text allows some variables in the format %FIELD% that are replaced with their associated value. The following variables are available:

  • %TOTAL% an approximation of the number of results
  • %EXACT% the exact number of results
  openindex.suggest.showHits = '';

Spellcheck widget options

openindex.spell.spellcheckFollow

Spell check header text when there is a spell check suggestion and the user's query yields no results at all. The text allows some variables in the format %FIELD% that are replaced with their associated value. The following variables are available:

  • %QUERY% the search query
  • %SUGGEST% the spelling suggestion
  openindex.spell.spellcheckFollow = "Nothing found for %QUERY%, displaying results for %SUGGEST% instead.";

openindex.spell.spellcheckSuggest

Spell check header text when there is a spell check suggestion and the user's query yields more than zero results.

  openindex.spell.spellcheckSuggest = "Did you mean %SUGGEST%?";

openindex.spell.autoFollowSuggest

Whether to automatically follow a spelling suggestion when there are no results for the user's search query.

  openindex.spell.autoFollowSuggest = true;

Pager widget options

openindex.pager.manyResults

Header text displayed when there more results than fit one search results page. The text allows some variables in the format %FIELD% that are replaced with their associated value. The following variables are available:

  • %QUERY% the search query
  • %TOTAL% an approximation of the number of results
  • %EXACT% the exact number of results
  • %START% the offset of the first result in the page
  • %END% the offset of the last result in the page
  • %PERPAGE% the number of results per page
  • %ELAPSED% time it took for this search request to return results
  openindex.pager.manyResults = "Displaying %START% to %END% of %TOTAL% results";

openindex.pager.fewResults

Header text displayed when there are few results for the search query meaning that there are equals or less results then the maximum length of the page. See openindex.pager.manyResults for formatting rules.

  openindex.pager.fewResults = "%TOTAL% results found";

openindex.pager.oneResult

Header text displayed when is exactly on result for the search query. See openindex.pager.manyResults for formatting rules.

  openindex.pager.oneResult = "Exactly one result found";

openindex.pager.noResults

Header text displayed when there are no results for the search query. See openindex.pager.manyResults for formatting rules.

  openindex.pager.noResults = "No results found for %QUERY%";

openindex.pager.duplicateResults

Header text displayed when there are too many duplicate results for the search query. Only available if deduplication is enabled via openindex.result.deduplicate, which is the default.

  openindex.pager.duplicateResults = "Too many duplicate results found, ";

openindex.pager.duplicateResultsLink

Link text displayed when there are too many duplicate results for the search query. Only available if deduplication is enabled via openindex.result.deduplicate, which is the default.

  openindex.pager.duplicateResultsLink = "try again without deduplication";

openindex.pager.prevLabel

Label text displayed on the pager's previous page button.

  openindex.pager.prevLabel = "&laquo; Previous";

openindex.pager.nextLabel

Label text displayed on the pager's next page button.

  openindex.pager.nextLabel = "Next &raquo;";

openindex.pager.rows

Instruct the search engine to return the specified number of rows per page. Regardless of the number of rows per page, the maximum number of pages that can be paged through remains 12. The maximum allowed value is 25.

  openindex.pager.rows = 10;

openindex.pager.autoStyle

The pager widget styles itself by default and should fit for most cases. The CSS rules are only added if no CSS rules on .oi-pager are already defined.

  openindex.pager.autoStyle = true;

Type widget options

openindex.type.header

Header text for the file type faceting widget. The header and the widget are not displayed when no constraints are available for this facet.

  openindex.type.header = "File type";

openindex.type.mapping

The constraint mapping for the file type faceting widget. The constraint mapping does not apply to the filter parameters in the URL.

  openindex.type.mapping =
  {
    "text/html" : "Webpage",
    "application/pdf" : "PDF Document",
    "application/document" : "Office document",
    "application/spreadsheet" : "Office spreadsheet"
  };

openindex.type.pref

Instruct the search engine to prefer or boost a specific file type. Valid values are text/html and application/pdf. Leave this parameter empty to disable type preferences. You can also boost multiple values and specify your boost like openindex.type.pref = "text/html=2,application/pdf=1.5";. Boosts work like multipliers, don't set them too high, or below 1.0.

  openindex.type.pref = "text/html";

openindex.type.restrict

Instruct the search engine to always restrict the search to the specified type. Valid values are any of the available types. You cannot use the mapped values. Leave this parameter empty to disable type restriction.

  openindex.type.restrict = "";

openindex.type.multiSelect

Whether or not this widget allows multiple values to be selected at the same time.

  openindex.type.multiSelect = false;

openindex.type.selectAllButton

To select all results a user must deselect previously selected filters. By enabling this feature a select-all button is added. When clicked, all selected filters are deselected. Showing a filter's count is no longer possible.

  openindex.type.selectAllButton = false;

openindex.type.selectAllButtonText

The text of the select-all button.

  openindex.type.selectAllButtonText = "all";

Host widget options

openindex.host.header

Header text for the host faceting widget. The header and the widget are not displayed when no constraints are available for this facet.

  openindex.host.header = "Website";

openindex.host.mapping

The constraint mapping for the host faceting widget. The constraint mapping does not apply to the filter parameters in the URL.

  openindex.host.mapping =
  {
    "www.example.org" : "Example",
    "download.example.org" : "Download"
  };

openindex.host.pref

Instruct the search engine to prefer or boost a specific host. Valid values is any available hosts within your subscription. Leave this parameter empty to disable host preferences. You can also boost multiple values and specify your boost like openindex.host.pref = "example.org=2,example.com=1.5";. Boosts work like multipliers, don't set them too high, or below 1.0.

  openindex.host.pref = "";

openindex.host.restrict

Instruct the search engine to always restrict the search to the specified host. Valid values are any of the available hosts. You cannot use the mapped values. Leave this parameter empty to disable host restriction.

  openindex.host.restrict = "";

openindex.host.multiSelect

Whether or not this widget allows multiple values to be selected at the same time.

  openindex.host.multiSelect = false;

openindex.host.selectAllButton

To select all results a user must deselect previously selected filters. By enabling this feature a select-all button is added. When clicked, all selected filters are deselected. Showing a filter's count is no longer possible.

  openindex.host.selectAllButton = false;

openindex.host.selectAllButtonText

The text of the select-all button.

  openindex.host.selectAllButtonText = "all";

Language widget options

openindex.lang.header

Header text for the language faceting widget. The header and the widget are not displayed when no constraints are available for this facet.

  openindex.lang.header = "Language";

openindex.lang.mapping

The constraint mapping for the language faceting widget. The constraint mapping does not apply to the filter parameters in the URL.

  openindex.lang.mapping =
  {
    "af":"Afrikaans",
    "ar":"العربية",
    "bg":"Български",
    "bn":"বাংলা",
    "cs":"Česky",
    "da":"Dansk",
    "de":"Deutsch",
    "el":"Ελληνικά",
    "en":"English",
    "es":"Español",
    "et":"Eesti",
    "fa":"فارسی",
    "fi":"Suomi",
    "fr":"Français",
    "fy":"Frysk",
    "gu":"ગુજરાતી",
    "he":"עברית",
    "hi":"हिन्दी",
    "hr":"Hrvatski",
    "hu":"Magyar",
    "id":"Bahasa Indonesia",
    "is":"Íslenska",
    "it":"Italiano",
    "ja":"日本語",
    "kn":"ಕನ್ನಡ",
    "ko":"한국어",
    "lt":"Lietuvių",
    "lv":"Latviešu",
    "mk":"Македонски",
    "ml":"മലയാളം",
    "mr":"मराठी",
    "ne":"नेपाली",
    "nl":"Nederlands",
    "no":"Norsk (bokmål)",
    "pa":"ਪੰਜਾਬੀ",
    "pl":"Polski",
    "pt":"Português",
    "ro":"Română",
    "ru":"Русский",
    "sk":"Slovenčina",
    "sl":"Slovenščina",
    "so":"Soomaaliga",
    "sq":"Shqip",
    "sv":"Svenska",
    "sw":"Kiswahili",
    "ta":"தமிழ்",
    "te":"తెలుగు",
    "th":"ไทย",
    "tl":"Tagalog",
    "tr":"Türkçe",
    "uk":"Українська",
    "ur":"اردو",
    "vi":"Tiếng Việt",
    "zh-cn":"中文",
    "zh-tw":"國語"
  };

openindex.lang.pref

Instruct the search engine to prefer or boost a specific language. Valid values is any of the above ISO 639-1 language codes, navigator, geo or auto. If the preference is navigator the engine will defer language preference to the browser's current language settings, geo will map a list of languages to your user's current geographical location, countries with multiple native languages are supported. For auto the engine will pick the preferred language from either source. Leave this parameter empty to disable language preferences. You can also boost multiple values and specify your boost like openindex.lang.pref = "fy=2,nl=1.5";. Boosts work like multipliers, don't set them too high, or below 1.0.

  openindex.lang.pref = "navigator";

openindex.lang.restrict

Instruct the search engine to always restrict the search to the specified language. Valid values are any of the available languages. You cannot use the mapped values. Leave this parameter empty to disable language restriction.

  openindex.lang.restrict = "";

openindex.lang.multiSelect

Whether or not this widget allows multiple values to be selected at the same time.

  openindex.lang.multiSelect = false;

openindex.lang.selectAllButton

To select all results a user must deselect previously selected filters. By enabling this feature a select-all button is added. When clicked, all selected filters are deselected. Showing a filter's count is no longer possible.

  openindex.lang.selectAllButton = false;

openindex.lang.selectAllButtonText

The text of the select-all button.

  openindex.lang.selectAllButtonText = "all";

Category widget options

openindex.cat.header

Header text for the category faceting widget. The header and the widget are not displayed when no constraints are available for this facet. See the question on how to add values from HTML metadata.

  openindex.cat.header = "Category";

openindex.cat.mapping

The constraint mapping for the category faceting widget. The constraint mapping does not apply to the filter parameters in the URL. Mapping the category facet is usually not needed as the proper values are already defined in your search service, if you have enabled it. It can, however, be used to quickly rename an already configured category name without having to reindex the whole website.

  openindex.cat.mapping =
  {
    "Category A" : "Some other category",
    "Some website section" : "Renamed category"
  };

openindex.cat.pref

Instruct the search engine to prefer or boost a specific category. Valid values is any available category defined within your subscription. Leave this parameter empty to disable category preferences. You can also boost multiple values and specify your boost like openindex.cat.pref = "some_category=2,another_category=1.5";. Boosts work like multipliers, don't set them too high, or below 1.0.

  openindex.cat.pref = "";

openindex.cat.restrict

Instruct the search engine to always restrict the search to the category. Valid values are any of the available categories. You cannot use the mapped values. Leave this parameter empty to disable category restriction.

  openindex.cat.restrict = "";

openindex.cat.multiSelect

Whether or not this widget allows multiple values to be selected at the same time.

  openindex.cat.multiSelect = false;

openindex.cat.selectAllButton

To select all results a user must deselect previously selected filters. By enabling this feature a select-all button is added. When clicked, all selected filters are deselected. Showing a filter's count is no longer possible.

  openindex.cat.selectAllButton = false;

openindex.cat.selectAllButtonText

The text of the select-all button.

  openindex.cat.selectAllButtonText = "all";

Date range widget options

openindex.date.header

Header text for the date faceting widget. The header and the widget are not displayed when no constraints are available for this facet.

  openindex.date.header = "Period";

openindex.date.mapping

The constraint mapping for the date faceting widget. The constraint mapping does not apply to the filter parameters in the URL.

  openindex.date.mapping =
  {
    "week" : "Week",
    "today" : "Today",
    "month" : "Month"
  };

openindex.date.pref

Date preferences work differently than the other preference settings. Instead of preferring a static value this setting acts on the notion of recency of documents. Recent documents are boosted and older documents are punished. In this example, documents younger than 50 days are boosted, older than 50 days are punished. Set to 0 to disable it.

  openindex.date.pref = 50;

openindex.date.threshold

The lower threshold for punishment of older documents. A value of 1.0 means documents older than openindex.date.pref days are not punished.

  openindex.date.threshold = 0.9;

openindex.date.restrict

Instruct the search engine to always restrict the search to the date range Valid values are any of the available date ranges. You cannot use the mapped values. Leave this parameter empty to disable date restriction.

  openindex.date.restrict = "";

Trending widget options

openindex.trending.header

Header text for the trending pages widget.

  openindex.trending.header = "Trending pages";

openindex.trending.excludeCurrent

If true, the current viewing page, if trending, is not shown in the trending pages widget. Due to caching, changes to this setting may not take effect for 15 minutes.

  openindex.trending.excludeCurrent = false;

openindex.trending.dateRestrict

Whether to restrict the set of trending pages to a date range. Valid values are week, month and year. No value means no date restriction. Due to caching, changes to this setting may not take effect for 15 minutes.

  openindex.trending.dateRestrict = null;

openindex.trending.preCallback

Callback function to call just before a trending request is executed. This function call is blocking, possible errors inside the callback function are caught in a try/catch block to prevent disruption of the service. No logging is available.

  openindex.trending.preCallback = function() { alert("hello"); };

openindex.trending.postCallback

Callback function to call after trending request is executed. This function call is blocking, possible errors inside the callback function are caught in a try/catch block to prevent disruption of the service. No logging is available.

  openindex.trending.postCallback = function() { alert("hello"); };

Popular widget options

openindex.popular.header

Header text for the popular pages widget.

  openindex.popular.header = "Popular pages";

openindex.popular.excludeCurrent

If true, the current viewing page, if popular, is not shown in the popular pages widget. Due to caching, changes to this setting may not take effect for 15 minutes.

  openindex.popular.excludeCurrent = false

openindex.popular.dateRestrict

Whether to restrict the set of popular pages to a date range. Valid values are week, month and year. No value means no date restriction. Due to caching, changes to this setting may not take effect for 15 minutes.

  openindex.popular.dateRestrict = null;

openindex.popular.preCallback

Callback function to call just before a popular request is executed. This function call is blocking, possible errors inside the callback function are caught in a try/catch block to prevent disruption of the service. No logging is available.

  openindex.popular.preCallback = function() { alert("hello"); };

openindex.popular.postCallback

Callback function to call after popular request is executed. This function call is blocking, possible errors inside the callback function are caught in a try/catch block to prevent disruption of the service. No logging is available.

  openindex.popular.postCallback = function() { alert("hello"); };

openindex.queries.header

Header text for the related queries widget. The header and the widget are not displayed when no related queries are found for the user's search terms.

  openindex.queries.header = "Related queries";

Page not found widget options

openindex.notfound.text

The text to display for a 404 suggestion. %LINK% is replaced by the hyperlink of the suggested page.

  openindex.notfound.text = "Is this %LINK% the page you are looking for?";

openindex.notfound.defaultText

Default text that is displayed if no suggestion for a 404 could be found.

  openindex.notfound.defaultText = "Unfortunately the page you are looking for does not exist (anymore). Please <a href="https://www.openindex.io/">visit our home page</a>.";

Probability filtering

openindex.probabilities.*

Openindex sitesearch classifies web pages when they are fetched and processed from your servers. These classifications help with ordering your search results, pushing less interesting pages further down the search result set. With probability filtering, you can also force the engine to only show results that are classified within a certain range. Ranges are always between 0.0 and 1.0 inclusive, and a high probability means the engine is more confident a web page is classified correctly. In general, probabilities lower than 0.7 are less useful. Check our online data extraction tool to see what our systems think of your web pages. There are three options for probability filtering:

thread
signifies a forum thread / discussion page
product
signifies a webshop product page
article
signifies an article page
  openindex.probabilities.thread = "[0.5 TO 1.0]";

Recommended pages widget

openindex.recommendations.mode

Mode the recommender operates in. Set to uid to provide user-specific recommendations. Set to document to get only document-specific recommendations.

  openindex.recommendations.mode = "uid";

openindex.recommendations.excludeRecentlyViewed

If enabled, recently viewed pages are not recommended to the user. This can, in some cases, cause no recommendations to be presented at all.

  openindex.recommendations.excludeRecentlyViewed = true;

Related pages widget

openindex.related.header

Header text for the related pages widget. The header and the widget are not displayed when no related pages are found for the current URL.

  openindex.related.header = "Related pages";

openindex.related.sourceSelector

This parameter can contain a selector. By default, the currently viewing document is used as the source for the related pages

  openindex.related.sourceSelector = null;

openindex.related.preCallback

Callback function to call just before a related request is executed. This function call is blocking, possible errors inside the callback function are caught in a try/catch block to prevent disruption of the service. No logging is available.

  openindex.related.preCallback = function() { alert("hello"); };

openindex.related.postCallback

Callback function to call after related request is executed. This function call is blocking, possible errors inside the callback function are caught in a try/catch block to prevent disruption of the service. No logging is available.

  openindex.related.postCallback = function() { alert("hello"); };

Traffic widget

openindex.traffic.header

Header text for the traffic widget. The header and the widget are not displayed when no related pages are found for the current URL.

  openindex.traffic.header = "From other sites";

openindex.traffic.sourceSelector

This parameter can contain a selector. By default, the currently viewing document is used as the source for the related pages

  openindex.traffic.sourceSelector = null;

openindex.traffic.ssi

Usually an additional SSI key is used for this feature. Contact support@openindex.io to obtain your SSI for a group of websites.

  openindex.traffic.ssi = "YOUR_KEY_HERE";

openindex.traffic.hosts

The hosts parameter can be used to narrow the selection to a specific list of hosts. Leave empty to get related webpages from all your websites.

  openindex.traffic.hosts = [];

openindex.traffic.preCallback

Callback function to call just before a traffic request is executed. This function call is blocking, possible errors inside the callback function are caught in a try/catch block to prevent disruption of the service. No logging is available.

  openindex.traffic.preCallback = function() { alert("hello"); };

openindex.traffic.postCallback

Callback function to call after traffic request is executed. This function call is blocking, possible errors inside the callback function are caught in a try/catch block to prevent disruption of the service. No logging is available.

  openindex.traffic.postCallback = function() { alert("hello"); };

Miscellaneous options

openindex.recordViews

Page views are registered by default and view time is measured. Recording views is required for both topical widgets, the popular and trending page widgets. Recording views also allows to come up with better recommendations. If, for any reason, you do not want or need these features, set it to false to disable. We strongly advise you to use canonical URL's in your metatags to prevent duplicates. Views are not recorded on pages that have a robots=noindex metatag.

  openindex.recordViews = true;

openindex.url

Contains the current URL. By setting this to a different URL, you can fool the search engine to find related items for the new URL when the engine operated in related mode if the canonical URL is not set. Keep in mind that the canonical url takes precendence over this setting.

  openindex.url = "http..";

openindex.submitTo

Instruct the search engine to redirect the the specified URL upon submission of the search box. This option must contain the URL of your search results page on pages other than the main search results page. It defaults the form's action attribute if it is present.

  openindex.submitTo = null;

openindex.safe

Instructs the search engine which safe search policy to employ. Valid values are low, normal, high and off.

  openindex.safe = "off";

openindex.tls

Whether to use TLS/SSL for communication with the search service. By default the JavaScript engine will use the same transport as the page it is loaded on. So it will automatically use TLS on secured pages. All search queries, images and clicked outlinks will be using secure communication. Set this value to true to also use TLS on non-secured pages.

  openindex.tls = false;

openindex.preCallback

Callback function to call just before a search request is executed, the parameter passed is the user's query. This function call is blocking, possible errors inside the callback function are caught in a try/catch block to prevent disruption of the search service. No logging is available.

  openindex.preCallback = function(q) { alert(query); };

openindex.postCallback

Callback function to call after search request is executed, the parameter passed is the user's query and the number of documents found. This function call is blocking, possible errors inside the callback function are caught in a try/catch block to prevent disruption of the search service. No logging is available.

  openindex.postCallback = function(query, numFound) { alert(query + numFound); };

openindex.lease

The lease time for secure search. The value should be time in seconds since the UNIX epoch in UTC at which the lease expires. Enable this setting only if you have secure search enabled.

  openindex.lease = -1;

openindex.hmac

The Base64 encoded string of the raw binary SHA1 HMAC. Enable this setting only if you have secure search enabled.

  openindex.hmac = '';

Engine function call

openindex.setSsid(document.cookie);

Some browsers, mostly mobile, drop third-party cookies after a session. This prevents us from seeing the end-users preferences and interests, it then also prevents us from providing any meaningful recommendations to end-users using such a browser.
You can work around this problem by calling setSSid(), passing it your set of cookies and setting the return value as your cookies. The method reads the value for the ssid and uses it as the user ID. If the cookie value is not yet present, a cryptographic hash is calculated and sets that as the value for the ssid cookie. All other cookies are left untouched, they are neither read nor modified in any way.

  document.cookie = openindex.setSsid(document.cookie);

openindex.reset();

Reset the search interface and removes parameters from the URL.

  openindex.reset();

Contact us
Please feel free to contact us now! Call 0(031) 50 85 36 620, send an e-mail or go to our contact page.
CONTACT US