Skip to content

Latest commit

 

History

History
178 lines (162 loc) · 4.03 KB

File metadata and controls

178 lines (162 loc) · 4.03 KB

Sample Discovery Jobs

This page was autogenerated by JobSamples.java on Thu Mar 05 08:50:44 PST 2015

Add a file

Add a file to the system

{
  "action": "ADD",
  "path": "/Users/ryan/workspace/quickstart-java/docs/imgs/links.png",
  "entry": {"fields": {
    "format": "image/png",
    "bytes": 70154
  }}
}

Add a URL

Add a URL to the system

{
  "action": "ADD",
  "path": "http://public.voyagergis.com/kml/TheBestPlaces.kml",
  "entry": {"fields": {
    "name": "TheBestPlaces",
    "format": "application/vnd.google-earth.kml+xml"
  }}
}

Add record without a resource reference

Fill in all the explicit properties

{
  "id": "record1234",
  "action": "ADD",
  "entry": {
    "geo": {
      "lat": 37.78875904932722,
      "lon": -122.38787244901528
    },
    "meta": {"body": "<xml>raw XML metadata<\/xml>"},
    "fields": {
      "name": "Name (1425574244431)",
      "abstract": "some longer text about what we have",
      "copyright": "some copyright message"
    }
  }
}

Entry with structure

children with index: false will appear in the tree, but not have their own record

{
  "id": "tree_1234",
  "action": "ADD",
  "entry": {
    "fields": {
      "name": "Tree Root",
      "abstract": "some longer text about what we have"
    },
    "children": [{
      "index": false,
      "fields": {"name": "Sub 1"},
      "children": [
        {"fields": {
          "name": "Child 0",
          "abstract": "more info in an entry (0)"
        }},
        {"fields": {
          "name": "Child 1",
          "abstract": "more info in an entry (1)"
        }},
        {"fields": {
          "name": "Child 2",
          "abstract": "more info in an entry (2)"
        }}
      ]
    }]
  }
}

The tree structure is displayed in the ui as:

structure

Entry with links

Items with links to other data.

{
  "id": "with_links_1234",
  "action": "ADD",
  "entry": {
    "geo": {
      "xmin": -88.59375,
      "ymin": 24.766785,
      "xmax": -78.222656,
      "ymax": 31.128199
    },
    "fields": {
      "name": "Item With Links",
      "abstract": "some longer text about what we have"
    },
    "links": [
      {
        "relation": "data",
        "name": "linked data",
        "path": "/Users/ryan/workspace/quickstart-java/docs/imgs/links.png",
        "format": "image/png"
      },
      {
        "relation": "data",
        "name": "tree data",
        "path": "/Users/ryan/workspace/quickstart-java/docs/imgs/structure.png"
      }
    ]
  }
}

Links are displayed in the ui as:

structure

Entry with a preview/thumbnail image

{
  "id": "with_image_1234",
  "action": "ADD",
  "entry": {"fields": {
    "name": "An Item with a thumbnail",
    "image_url": "https://raw.githubusercontent.com/voyagersearch/quickstart-java/master/docs/imgs/eclipse_2_set_variable.png"
  }}
}

NOTE: setting the field 'path_to_thumb' expects the thumbnail to be in the ${meta.dir} folder

Entry with structure and child documents get indexed

When you add the '__to_extract', field, the child items are added to the extraction queue.

{
  "id": "tree_and_extract",
  "action": "ADD",
  "entry": {
    "fields": {
      "name": "Tree Root",
      "abstract": "some longer text about what we have"
    },
    "children": [{
      "index": false,
      "fields": {"name": "Sub 1"},
      "children": [
        {"fields": {
          "name": "The Links PNG",
          "format": "image/png",
          "title": "Some Title From the Job",
          "path": "/Users/ryan/workspace/quickstart-java/docs/imgs/links.png",
          "__to_extract": true
        }},
        {"fields": {
          "name": "A Structure PNG",
          "abstract": "an abstract field",
          "path": "/Users/ryan/workspace/quickstart-java/docs/imgs/structure.png",
          "__to_extract": true
        }}
      ]
    }]
  }
}

After extraction, all fields configured by the parent will exist in the child.