Skip to main content

Develop with FastTrack

Data tier: MarkLogic

The steps in this section configure MarkLogic for a FastTrack-enabled project. Complete these steps with MarkLogic server installed and running.

Databases and App Server

MarkLogic databases store the documents that a FastTrack project searches. A MarkLogic app server exposes these documents through a REST API. These setup steps use the Documents and Modules databases and the App-Services app server. These are automatically created when MarkLogic is initialized.

Note

  • The setup script configures the App-Services app server to use basic authentication.

  • The Documents and Modules databases are located under the Databases heading in the MarkLogic Administration Interface. App-Services is located under App Servers. The Administration Interface can be accessed on port 8001 (http://localhost:8001/).

User

MarkLogic applications require a user with permission to execute searches via MarkLogic's REST API. The set up script creates a new fasttrack-getting-started-user with a rest-admin role.

For more information about MarkLogic users and roles, see the Security Guide.

Documents

The set up script loads a set of JSON documents that describe persons in the Documents database. These documents can be searched with the application. Here is an example of a document:

{ "envelope": {
    "entityType": "person",
    "id": 1001,
    "firstName": "Nerta",
    "lastName": "Hallwood",
    "title": "Marketing Manager",
    "status": "active",
    "dob": "1985-03-04",
    "salary": 104000,
    "address": {
      "street": "40 Summer Ridge Point",
      "city": "Cincinnati",
      "state": "Ohio",
      "country": "United States",
      "latitude": 39.1848,
      "longitude": -84.3448
    },
    "image": "person-1001.jpg",
    "content": "And this, our life, exempt from public haunt, finds tongues in trees, books in the running brooks, sermons in stones, and good in everything.",
    "relations": [
      {
        "triple": {
          "subject": "http://example.org/1001",
          "predicate": "http://xmlns.com/foaf/0.1/knows/",
          "object": {
              "datatype" : "http://www.w3.org/2001/XMLSchema#string",
              "value":"1002"
            }
          }
      },
      {
        "triple": {
          "subject": "http://example.org/1001",
          "predicate": "http://xmlns.com/foaf/0.1/knows/",
          "object": {
              "datatype" : "http://www.w3.org/2001/XMLSchema#string",
              "value":"1003"
            }
          }
      }
    ]
  }
}

Query options

Query options can customize MarkLogic search results. The set up script loads query options into the Modules database that allow a match "snippet" to be returned for each result. A snippet includes contextual information about what values in the documents matched the search query.

For more information about query options and how they affect search results, see Search Customization Using Query Options.

Install dependencies

Install these dependencies by running this command from the fasttrack-getting-started/setup directory:

npm install

Run the set up script

To configure the app server, set up a user, load example documents, and install query options:

  1. Run this command from the fasttrack-getting-started/setup directory:

    npm start

    The set up script configuration is stored in the setup/config.js file. This file can be edited if needed.

  2. After running the command, confirm that documents were loaded by opening MarkLogic's QConsole application at port 8000 and explore the Documents and Modules databases at http://localhost:8000/qconsole.