Skip to content

Instantly share code, notes, and snippets.

@erick-otenyo
Created January 16, 2018 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erick-otenyo/354238364ae5641d23d4dbb6da98bc94 to your computer and use it in GitHub Desktop.
Save erick-otenyo/354238364ae5641d23d4dbb6da98bc94 to your computer and use it in GitHub Desktop.
function(doc) {
if (doc.category === "venue") {
if (doc.name) {
index("name", doc.name, {"store": true,"index": true});
}
if (doc.geometry) {
index("lon", doc.geometry.coordinates[0], {"store": true,"index":false});
index("lat", doc.geometry.coordinates[1], {"store": true,"index":false});
}
if (doc.price_per_hour) {
index("price_per_hour", doc.price_per_hour, {"store": true,"index": true});
}
if (doc.activities) {
for (var i in doc.activities) {
if (doc.activities.hasOwnProperty(i)) {
index(i, doc.activities[i]);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment