This application was generated by the MarkLogic-Node Slush generator, with the following components:
- AngularJS
- Gulp
- node.js: very thin layer, hosting the Angular code and proxying MarkLogic REST API requests
- Roxy Deployer: bootstrap MarkLogic databases, application servers, etc; scaffolding for MarkLogic REST API service extensions
- add local.properties to override default setting such as ML ports (default: 8040) and ML admin username and password (default: admin:admin)
$ ./ml local bootstrap
$ ./ml local deploy modules
- edit gulpfile.js. In the options section near the top, set your desired ports
$ gulp
# this will watch the .less file for changes and compile them to .css and start the node server
Direct your browser to http://localhost:8040/v1/resources/load-recalls and it will begin to load data into the database.
Below is a sample of the XML created.
<recall>
<recall_number>F-0771-2015</recall_number>
<reason_for_recall>Possible contamination with Listeria monocytogenes.</reason_for_recall>
<status>Ongoing</status>
<distribution_pattern>
<distribution_state lat="40.0583238" lng="-74.4056612">New Jersey</distribution_state>
<distribution_state lat="43.2994285" lng="-74.2179326">New York</distribution_state>
<distribution_state lat="40.4172871" lng="-82.9071230">Ohio</distribution_state>
<distribution_state lat="41.2033216" lng="-77.1945247">Pennsylvania</distribution_state>
<distribution_state lat="41.5800945" lng="-71.4774291">Rhode Island</distribution_state>
<distribution_state lat="37.4315734" lng="-78.6568942">Virginia</distribution_state>
</distribution_pattern>
<product_quantity>48 units</product_quantity>
<recall_initiation_date>2014-12-09</recall_initiation_date>
<state>MD</state>
<event_id>69983</event_id>
<product_type>Food</product_type>
<product_description>Red Apple W/ Cheese Net Wt: 5oz. (142g) Best If Enjoyed By: 12/06/14, DISTRIBUTED BY SHEETZ DISTRIBUTION SERVICES, LLC. CLAYSBURG, PA 16625 UPC 759465009829</product_description>
<country>US</country>
<city>Jessup</city>
<recalling_firm>Del Monte Fresh Produce NA, Inc</recalling_firm>
<report_date>2015-01-21</report_date>
<epoch>1424553174.83649</epoch>
<voluntary_mandated>Voluntary: Firm Initiated</voluntary_mandated>
<classification>Class I</classification>
<code_info>Lot 2332101</code_info>
<id>007662ab8a2f5a736c4cc0d68d84ed056e47b784526613faaa9987290fbb6c3d</id>
<openfda>
</openfda>
<initial_firm_notification>Press Release</initial_firm_notification>
</recall>
Located at rest-api/config/options/all.xml, the significant lines are the ones below that define constraints and extract metadata.
<search:constraint name="Distribution State">
<search:range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint">
<search:facet-option>limit=10</search:facet-option>
<search:facet-option>frequency-order</search:facet-option>
<search:facet-option>descending</search:facet-option>
<search:element ns="" name="distribution_state"/>
</search:range>
</search:constraint>
<search:constraint name="Classification">
<search:range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint">
<search:facet-option>limit=5</search:facet-option>
<search:facet-option>frequency-order</search:facet-option>
<search:facet-option>descending</search:facet-option>
<search:element ns="" name="classification"/>
</search:range>
</search:constraint>
<search:constraint name="Recalling Firm">
<search:range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint">
<search:facet-option>limit=5</search:facet-option>
<search:facet-option>frequency-order</search:facet-option>
<search:facet-option>descending</search:facet-option>
<search:element ns="" name="recalling_firm"/>
</search:range>
</search:constraint>
<search:constraint name="Product Type">
<search:range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint">
<search:facet-option>limit=5</search:facet-option>
<search:facet-option>frequency-order</search:facet-option>
<search:facet-option>descending</search:facet-option>
<search:element ns="" name="product_type"/>
</search:range>
</search:constraint>
<search:constraint name="Status">
<search:range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint">
<search:facet-option>limit=5</search:facet-option>
<search:facet-option>frequency-order</search:facet-option>
<search:facet-option>descending</search:facet-option>
<search:element ns="" name="status"/>
</search:range>
</search:constraint>
<search:extract-metadata>
<search:qname elem-ns="" elem-name="reason_for_recall"/>
<search:qname elem-ns="" elem-name="product_description"/>
<search:constraint-value ref="Classification"/>
<search:constraint-value ref="Status"/>
<search:constraint-value ref="Product Type"/>
<search:constraint-value ref="Recalling Firm"/>
</search:extract-metadata>
Located at deploy/ml-config.xml, within the range-element-indexes element you can find the indexes this application uses.
<range-element-index>
<scalar-type>string</scalar-type>
<namespace-uri></namespace-uri>
<localname>distribution_state</localname>
<collation>http://marklogic.com/collation/codepoint</collation>
<range-value-positions>false</range-value-positions>
</range-element-index>
<range-element-index>
<scalar-type>string</scalar-type>
<namespace-uri></namespace-uri>
<localname>classification</localname>
<collation>http://marklogic.com/collation/codepoint</collation>
<range-value-positions>false</range-value-positions>
</range-element-index>
<range-element-index>
<scalar-type>string</scalar-type>
<namespace-uri></namespace-uri>
<localname>recalling_firm</localname>
<collation>http://marklogic.com/collation/codepoint</collation>
<range-value-positions>false</range-value-positions>
</range-element-index>
<range-element-index>
<scalar-type>string</scalar-type>
<namespace-uri></namespace-uri>
<localname>product_type</localname>
<collation>http://marklogic.com/collation/codepoint</collation>
<range-value-positions>false</range-value-positions>
</range-element-index>
<range-element-index>
<scalar-type>string</scalar-type>
<namespace-uri></namespace-uri>
<localname>status</localname>
<collation>http://marklogic.com/collation/codepoint</collation>
<range-value-positions>false</range-value-positions>
</range-element-index>