Created
May 15, 2011 20:07
-
-
Save anonymous/973486 to your computer and use it in GitHub Desktop.
Google Books for music - example of data representation and desired query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In the following example I show how I set up my river and GET a sample document. Music is represented as an array of | |
# neumes. Every neume has a name, location (specified in box coordinates - [lower right y, upper left x, upper left y, | |
# lower right x]), and a sequence of pitch names. The goal is to be able to return the appropriate box coordinates for | |
# either a series of neume names or a sequence of pitches. So, in the given example, a user could search for the nueme | |
# sequence "punctum, scandicus, clivis" and the returned result would contain the box coordinates for that 3-neume | |
# sequence ("location": [9,0,14,12]). The user could also search for the pitch sequence "c, a, f" and the returned result | |
# would contain the box coordinates for the neumes containing that sequence ("location": [9, 6, 7, 12]). | |
curl -XPUT 'localhost:9200/_river/liber_usualis/_meta' -d '{ | |
> "type" : "couchdb", | |
> | |
> "couchdb" : { | |
> "host" : "localhost", | |
> "port" : 5984, | |
> "db" : "pages" | |
> } | |
> }' | |
$$$$ LOG RESPONSE: {"ok":true,"_index":"_river","_type":"liber_usualis","_id":"_meta","_version":1} | |
>curl -XGET 'localhost:9200'pages/pages/29dba696c1d393ced52b2bf9e80016be' | |
$$$$ LOG RESPONSE: { | |
"_index":"pages", | |
"_type":"pages", | |
"_id":"29dba696c1d393ced52b2bf9e80016be", | |
"_version":1, | |
"_source" : { | |
"music":[ | |
{"neume":"punctum","location":[1,2,3,4],"pname":"a"}, | |
{"neume":"punctum","location":[13,0,14,25],"pname":"b"}, | |
{"neume":"scandicus","location":[5,6,7,8],"pname":["b","g","c","a"]}, | |
{"neume":"clivis","location":[9,10,11,12],"pname":["f","e"]}, | |
{"neume":"podatus","location":[34,20,40,19],"pname":["c","d"]} | |
], | |
"_rev":"4-d754a8df2d21583914783fc066132200", | |
"_id":"29dba696c1d393ced52b2bf9e80016be", | |
"pagen":1 | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment