Skip to content

Repository files navigation

Ranged-buckets

Suppose you have data that includes an upper and a lower bound of some value.

<doc>
  <lo>2</lo>
  <hi>5</hi>
</doc>

How would you bucket these? Suppose we want to build facets like 1-4, 5-8, etc. This repo has code that demostrates how to do it.

Setup

Configuration

To run this code, you will need to have MarkLogic installed. (Tested with ML7; ought to work with ML6+.) You will also need Ruby 1.9.3+ to run the Roxy Deployer. Then:

  • if needed, identify some available ports on your MarkLogic instance. Defaults used here are 8060 and 8061. See deploy/build.properties.
  • $ ./ml local bootstrap
  • $ ./ml local deploy modules

Data

qconsole/ranged-buckets in a Query Console workspace. Go to http://localhost:8000/qconsole and import it. Execute the code in the buffer called "generate data". This will create 10,000 documents, each with random values for and elements, with the values in the range of [0..20].

Running the Code

Custom Constraint

You can execute the custom constraint through the REST API using these URLs:

http://localhost:8060/v1/search?options=startfinish.xml
http://localhost:8060/v1/search?options=finish.xml
http://localhost:8060/v1/search?options=lo.xml

Note that you may need to change the port if you configured your app server differently.

About

Sample code to illustrate ranged bucket facets with MarkLogic.

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages