Skip to content

Perform Search Requests

Perform Search Requests

To perform search request(s), send an array of one or more Search Request objects.

The server will respond with an array of Page of Results, one for each Search Request, in the order the Search Requests were sent.

URL: /api/search/

Method: POST

Content-Type: application/json

Search Request

All attributes in the Search Request have defaults and are optional. It is possible to perform a search request with all defaults simply by providing an empty object.

Attribute Description
requeststring The search request
Default xfirstword
indexesstring[] Array of index names to search
Pass an empty array to search all indexes
Default: Empty array
pagenumber The page to retrieve
Default:  1
resultsPerPage number The number of results to retrieve per page
Default: 10
fuzziness number dtSearch Fuzziness setting
Default: 0
getSynopsis boolean Retrieve a synopsis for each Search Result
Default: false
synopsisOptions object Refer to SynopsisOptions
enableWordNetRelated boolean Enable synonym expansion using WordNet related words. See Synonym searching
Default false
enableWordNetSynonyms boolean Enable synonym expansion using WordNet synonyms. See Synonym searching
Default false
stemmingFile string|null Stemming rules file.
Use Discovery to view available Stemming Files
Pass null to disable stemming
Default null
thesaurusFile string|null The User Thesaurus file to use.
Use Discovery to view available Thesaurus Files
Pass null to disable User Thesaurus
Default null
sort string How to sort search results
most-relevant, least-relevant, newest-first, oldest-first,a-z,z-a
OR a bitwise combination of dtSearch Sort Flags 
Default most-relevant
sortField string|null When sorting by user field, the field to sort on.
Default null
getFacetInfo boolean Whether or not to retrieve Facet Information in the search request.
maxFacetFieldValues number When retrieving Facet Information, the maximum number of values to retrieve per field.
Default 10

Synopsis Options

Attribute Description
beforeHit string String to insert before hit in document
Default <span class='synopsis-hit'>
afterHit string String to insert after hit in document
Default </span>
maxWordsToRead number Number of words to scan in each document looking for blocks of context to include.
Default 5000
maxContextBlocks number Limit the number of blocks of context included.
Default 1
wordsOfContextExact number Specify the number of words of context to include.
Default 10

Page Of Results

Attribute Description
page number The page this page of results represents
totalPages number The total number of pages found
totalFileCount number The total number of files the search found
searchResults array Array of Search Result
searchErrors array Array of Errors that occurred resulting from the SearchRequest.
searchFacetInfo object|null Facet Information, if requested.

Search Result

Attribute Description
number number The Search Result Number
created string The creation date of the document
modified string The date the document was last modified
displayName string User friendly name to display for the document. May be empty.
docID number The Document ID.
fileName string The name of the file the search result was found in.
hitCount number The number of hits found in the document.
hitDetails array|null Details on words matched in this document. Array of string.
hits array Array of numbers representing the word-offset of hits in the document.
shortName string The documents Short Name
size number The size of the document in bytes
synopsis string The document synopsis, if requested
title string The title of the document
typeId number dtSearch File Type Identifier
userFields array Array of field value pairs found in this document when the document was indexed.
index string The index the document belongs to

Example Request

POST Request to /api/search/

[
    {
        "request": "homer",
        "indexes": ["Classics"],
        "getSynopsis": true
    }
]

Response Body

[
    {
        "totalFileCount": 1,

        "page": 1,
        "totalPages": 1,

        "searchResults": [
            {
                "number": 1,
                "created": "2019-11-07T12:51:01",
                "displayName": "Ulysses by James Joyce",

                "docID": 39,
                "filename": "C:/Ulysses_JamesJoyce.pdf",

                "hitCount": 5,
                "hitDetails": null,
                "hits": [
                    7757,
                    7754,
                    7681,
                    6926,
                    1221
                ],
                "modified": "2019-11-07T00:35:23",
                "shortName": "Ulysses_JamesJoyce",

                "size": 991835,
                "synopsis": "...but the desirable life is revealed only to the poor of heart, the life of <b>Homer</b>'s Phaeacians. From these words Mr Best turned an unoffending face to Stephen. -Mallarme, don",
                "title": "The Project Gutenberg EBook of Ulysses, by James Joyce",
                "typeId": 227,

                "userFields": null,
                "index": "Classics",

                "properties": null
            }
        ],
        "searchErrors": [],
        "searchFacetInfo": null
    }
]

Last update: June 21, 2020