DataExplorer Search

DataExplorer Search is a customizable faceted search interface available for all collections. It allows users to view search results in list or grid view. The DataExplorer plugin is a faceted search plugin that provides a customizable results display

Features and Facets

With the DataExplorer plugin, you can customize the fields displayed in search results and change the order of these fields. You can also perform the default faceted search, where the default facets are collections, keywords, file type, and date. Results can be filtered by selecting any combination of these facets. This plugin provides a basic faceted search with a customizable results display.

To access the DataExplorer plugin, use the following link in your build:
https://localhost:8443/dataexplorer/index.html

Customizable search results

The search results can be customized based on the fields defined in facet.js, as explained below.

List display of fields in search results

By default, the first four fields in ../dataexplorer/facet.js under fieldShowHideOrderSetting are displayed in the search results.

You can customize the displayed fields in the search results by clicking the settings icon at the top-right corner of the search box. This opens a preferences popup, where users can choose which fields are shown and reorder them according to their preference, allowing for a personalized view of the search results.


Click the plus to include a field and the minus to remove a field from the display. Use the arrow icons to arrange the fields in the desired order. Based on these selections, the results will be displayed as shown here:

Grid display of fields in search results

By selecting grid display in the settings preferences, the user can view the search results in grid view, as shown here:

Facet Filters

The default facets such as File Type, Keywords, and Modified Date appear in the left-hand menu. After selecting a facet, it shows an x mark, which can be clicked to deselect and remove it from the search results.

  1. File Type displays the available file types in the search results for filtering.
  2. Keywords shows related keywords from the search results, excluding the search term itself.
  3. Modified Date provides five options ranging from week to year, along with a custom date range. You can also add Collection as a facet by editing ../dataexplorer/facet.json.
  4. Collection shows which collections contain results for the search term. Additional meta tags can also be added as facets in the same way.

Adding a Facet in Searchblox

SearchBlox supports Collection, Title, Description, Language, Author, and Subject as facets, with Author and Subject applicable only to PDF files. The facet.js file is used to configure how search results are displayed, and its path after placing the plugin folder in SearchBlox is ../webapps/ROOT/dataexplorer/facet.js. To add a new facet filter, you need to define the field name, display name, and the size of filter values in facet.js. Facet filters can be of type string, number, or date. For custom facets, except predefined ones such as keywords, title, description, size, or date, you can add them in facet.js (for example, a facet field "group").

Fields in facets.js

The fields specific to the DataExplorer plugin are shown in bold in the table below, while all other fields are the same as those in the default faceted search plugin.

Fields in facet.jsDescription
facetsSpecify the facet fields to show. Default facets are collection, keywords, contenttype, and lastmodified date.
collectionSpecify the collections to include in the results. Can be a single collection or multiple collections separated by commas. Example: "collection": [1,2].
sortBtnsFields that can be used for sorting.
facetFiltersOrderOrder in which facet filters appear on the search page.
sortDirDirection of sorting: ascending or descending.
pageSizeNumber of results per page in faceted search.
showAutoSuggestEnable or disable autosuggest. For SmartSuggest, provide the URL, domain, cname, and language in smartAutoSuggestSettings.
defaultCnameDefault collection to search when the page loads.
adsDisplayEnable or disable featured results in the search results.
featuredResultsCountNumber of featured results to display.
predictSearchEnable predicted search results.
predictResultSizeParameters for predicted search results.
customDateDisplayTextCustom label text for date facet filters.
customDateEnableEnable or disable custom date filtering.
relatedQueryEnable or disable related queries by setting true or false. Default is true.
relatedQueryFieldsSpecify API key and collection details for related queries. Example: "apikey": "...", "field": "content", "operator": "and", "limit": "5", "terms": "10", "type": "phrase", "col": "".
dataToBeDisplayedFor collections like CSV or database, specify fields to display in tabular format. If "displayAll": true, all data is fetched.
tuneEnable relevancy tuning for search results by setting "enable": "true".
fieldShowHideOrderSetting*Specify field name and display name for fields to appear in search results. Use title:true to set a default title. Example: {field: 'title', display: 'Title', title: true}, {field: 'description', display: 'Description'}.
defaultViewTypeSet the default view type. Use NORMAL or GRID for the default display.*
defaultTypeBoolean operator for multiple search terms. Use AND for AND search; default is OR.
pluginDomainThe domain of SearchBlox from which the plugin fetches results.

The contents of facet.js are shown here.

window.facets = {
    facets: [{
            field: "colname",
            display: "Collection Name",
            size: "10"
        },
        {
            field: "contenttype",
            display: "File Type",
            size: "10"
        },
        {
            field: "keywords",
            display: "keywords",
            size: "10"
        },
        {
            field: "lastmodified",
            display: "Last Modified",
            dateRange: [{
                    name: "Last 24 hours",
                    calendar: "days",
                    value: "1"
                },
                {
                    name: "Past Week",
                    calendar: "days",
                    value: "7"
                },
                {
                    name: "Past Month",
                    calendar: "months",
                    value: "1"
                },
                {
                    name: "Past Year",
                    calendar: "years",
                    value: "1"
                }
            ]
        }
    ],
    customDateSettings: {
      customDateField:"Date",
      customDateEnable:"true",
      customDateDisplayText:"Custom"
    },
    collection: [],
    sortBtns: [{
            field: "lastmodified",
            display: "Sort by date"
        },
        {
            field: "relevance",
            display: "Sort by relevance"
        }
    ],
    facetFiltersOrder: [
      "colname","keywords"
    ],
    facetFiltersType: "AND",
    sortDir: "desc",
    matchAny: "off",
    pageSize: "10",
    showAutoSuggest: true,
    smartAutoSuggestSettings:{
      pluginDomain:"",
      cnameAutoSuggest:"",
      limit:"10",
      langForSuggest:"en"
    },
    defaultCname: "",
    adsDisplay: "true",
    featuredResultsCount: "3",
    predictSearch: "false",
    predictResultSize: "3",
    relatedQuery: false,
    relatedQueryFields: {
        apikey: "",
        field: "content",
        operator: "and",
        limit: "5",
        terms: "10",
        type: "phrase",
        col: ""
    },
    dataToBeDisplayed: {
        1: {
            title: "Title",
            description: "Description"
        },
        other: {
            description: "Description"
        },
        displayAll: true
    },
    tune: {
        "enable": "true",
        "tune.0": "5",
        "tune.1": "3",
        "tune.2": "2",
        "tune.3": "5",
        "tune.4": "180",
        "tune.5": "10"
    },
    fieldShowHideOrderSetting: [
      {field: 'title', display: 'Title', title: true},
      {field: 'description', display: 'Description'},
      {field: 'author', display: 'Author'},
      {field: 'size', display: 'Size'},
      {field: 'url', display: 'URL'},
      {field: 'uid', display: 'UID'},
      {field: 'score', display: 'Score'},
      {field: 'raw_score', display: 'Raw Score'},
      {field: 'colname', display: 'Colname'}
    ],
    defaultViewType: 'NORMAL',
    defaultType: "AND",
    pluginDomain: ""
};
  • To use a meta field as a facet, map the field in mapping.json. For CSV, Database, MongoDB, and AWS collections, map the values in csv.json, jdbc.json, mongodb.json, and amazonS3.json respectively, located at ../webapps/ROOT/WEB-INF/.
  • To add a facet field of type number or date, update the field in ../webapps/ROOT/WEB-INF/mapping.json for web and file collections. For CSV, Database, MongoDB, and AWS collections, map the values in the respective JSON files (csv.json, jdbc.json, mongodb.json, amazonS3.json) in ../webapps/ROOT/WEB-INF/.
    Reference: Custom Fields in Search

Sorting Search Results

IIn faceted search, users can sort results by date or relevance using the drop-down menu located at the top of the results, just below the search box. By default, results are sorted in descending order, but the order can be changed to ascending or descending using URL parameters. Additionally, a custom field can be specified for sorting by configuring it in facet.js.