Commit a41a660b authored by ZettaScript's avatar ZettaScript

Fix: search limit 1000 hits

parent 6dc3e688
# WorldWotMap
WorldWotMap v0.1.0, © 2018 Pascal Engélibert, Licence GNU AGPL v3
WorldWotMap v0.1.1, © 2018 Pascal Engélibert, Licence GNU AGPL v3
Ceci est une carte affichant les comptes Ğ1 et leurs certifications. La carte peut être incomplète, car il est facultatif de renseigner sa position géographique sur Cesium+.
......
......@@ -81,7 +81,7 @@ a, a:visited {
<div id="header-text">
<h1>WorldWotMap</h1>
<a href="#map">&#11015; Voir la map &#11015;</a>
<p>WorldWotMap v0.1.0, &copy; 2018 <a href="https://zettascript.org/contact.php">Pascal Engélibert</a> (<a href="https://www.gnu.org/licenses/agpl.html">Licence GNU AGPL v3</a>) (<a href="https://framagit.org/ZettaScript/worldwotmap/">dépôt Git</a>)</p>
<p>WorldWotMap v0.1.1, &copy; 2018 <a href="https://zettascript.org/contact.php">Pascal Engélibert</a> (<a href="https://www.gnu.org/licenses/agpl.html">Licence GNU AGPL v3</a>) (<a href="https://framagit.org/ZettaScript/worldwotmap/">dépôt Git</a>)</p>
<p>Ceci est une carte affichant les comptes Ğ1 et leurs certifications. La carte peut être incomplète, car il est facultatif de renseigner sa position géographique sur Cesium+.</p>
<a href="gencache.py">Programme Python pour exporter les données de duniter.db</a>
</div>
......@@ -94,6 +94,7 @@ a, a:visited {
<li>Bleu&nbsp;: wallet</li>
<li>Rouge&nbsp;: identité</li>
</ul>
<span id="mapmenu-naccounts"></span><br />
<div id="mapmenu-idcard" class="idcard" style="display: none;">
<input type="button" value="Déselectionner" onclick="" /><br />
<strong class="idcard-title"></strong><br />
......@@ -159,39 +160,43 @@ var active_account = null;
var map = L.map("map").setView([46.725, 2.834], 6);
L.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', {attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'}).addTo(map);
$.post("https://g1.data.duniter.fr/user/profile/_search", '{"query":{"bool":{"must":[{"exists":{"field":"geoPoint"}}]}},"from":1000,"size":1000,"_source":["title","geoPoint","avatar._content_type","address","city","description"]}', function(data) {
var accounts_data = data["hits"]["hits"];
for(var i=0; i < accounts_data.length; i ++) {
var account_data = accounts_data[i];
var point = L.circle([account_data["_source"]["geoPoint"]["lat"], account_data["_source"]["geoPoint"]["lon"]], {
color: "#08f",
fillColor: "#08f",
fillOpacity: 0.1,
radius: 50,
pubkey: account_data["_id"]// Yay! Hack because JS is so bad with pointers...
}).addTo(map);
point.bindPopup("<b>"+account_data["_source"]["title"]+"</b><br/>"+account_data["_id"]);
var account = new Account(account_data["_id"], account_data["_source"]["title"], [account_data["_source"]["geoPoint"]["lat"], account_data["_source"]["geoPoint"]["lon"]], account_data["_source"]["address"], account_data["_source"]["city"], point);
accounts[account_data["_id"]] = account;
point.on("popupopen", account.mapActiveAccount);
}
$.get("duniterdb.json", null, function(data) {
for(id in data["ids"]) {
if(id in accounts) {
accounts[id].point.setStyle({color: "red", fillColor: "red"});
}
//$.post("https://g1.data.duniter.fr/user/profile/_search", '{"query":{"bool":{"must":[{"exists":{"field":"geoPoint"}}]}},"from":1000,"size":1000,"_source":["title","geoPoint","avatar._content_type","address","city","description"]}', function(data) {
$.post("https://g1.data.duniter.fr/user/profile/_search", '{"query":{"bool":{"must":[{"exists":{"field":"geoPoint"}}]}},"from":0,"size":0,"_source":[]}', function(data) {
$("#mapmenu-naccounts").html(data["hits"]["total"]+" comptes trouvés");
$.post("https://g1.data.duniter.fr/user/profile/_search", '{"query":{"bool":{"must":[{"exists":{"field":"geoPoint"}}]}},"from":0,"size":'+data["hits"]["total"]+',"_source":["title","geoPoint","address","city","description"]}', function(data) {
var accounts_data = data["hits"]["hits"];
for(var i=0; i < accounts_data.length; i ++) {
var account_data = accounts_data[i];
var point = L.circle([account_data["_source"]["geoPoint"]["lat"], account_data["_source"]["geoPoint"]["lon"]], {
color: "#08f",
fillColor: "#08f",
fillOpacity: 0.1,
radius: 50,
pubkey: account_data["_id"]// Yay! Hack because JS is so bad with pointers...
}).addTo(map);
point.bindPopup("<b>"+account_data["_source"]["title"]+"</b><br/>"+account_data["_id"]);
var account = new Account(account_data["_id"], account_data["_source"]["title"], [account_data["_source"]["geoPoint"]["lat"], account_data["_source"]["geoPoint"]["lon"]], account_data["_source"]["address"], account_data["_source"]["city"], point);
accounts[account_data["_id"]] = account;
point.on("popupopen", account.mapActiveAccount);
}
for(var i=0; i < data["certs"].length; i ++) {
if(data["certs"][i][0] in accounts && data["certs"][i][1] in accounts && data["certs"][i][3] == 0) {
var line = L.polyline([accounts[data["certs"][i][0]].pos, accounts[data["certs"][i][1]].pos], {color:'black', weight:1, opacity:0.3}).addTo(map);
line.bindPopup("<b>"+accounts[data["certs"][i][0]].title+"</b> &rarr; <b>"+accounts[data["certs"][i][1]].title+"</b>");
certs.push(new Cert(data["certs"][i][0], data["certs"][i][1], line));
accounts[data["certs"][i][0]].certsIssued.push(ncerts);
accounts[data["certs"][i][1]].certsReceived.push(ncerts);
ncerts ++;
$.get("duniterdb.json", null, function(data) {
for(id in data["ids"]) {
if(id in accounts) {
accounts[id].point.setStyle({color: "red", fillColor: "red"});
}
}
}
for(var i=0; i < data["certs"].length; i ++) {
if(data["certs"][i][0] in accounts && data["certs"][i][1] in accounts && data["certs"][i][3] == 0) {
var line = L.polyline([accounts[data["certs"][i][0]].pos, accounts[data["certs"][i][1]].pos], {color:'black', weight:1, opacity:0.3}).addTo(map);
line.bindPopup("<b>"+accounts[data["certs"][i][0]].title+"</b> &rarr; <b>"+accounts[data["certs"][i][1]].title+"</b>");
certs.push(new Cert(data["certs"][i][0], data["certs"][i][1], line));
accounts[data["certs"][i][0]].certsIssued.push(ncerts);
accounts[data["certs"][i][1]].certsReceived.push(ncerts);
ncerts ++;
}
}
});
});
});
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment