1
我用Parse編寫了一個搜索函數,我試圖獲得超過100個結果。我已經添加了query.limit(1000),但搜索仍然只能得到100或更低的結果。解析搜索超過100個查詢
通過用戶輸入和用戶輸入值,搜索框下方的表格更新並顯示值。
function userSearch(searchValue) {
$('body').addClass('loading');
/*Users Per Country*/
$('#user-pagination tbody tr').remove();
/*Run Parse Query*/
var firstName = new Parse.Query("User");
firstName.limit(1000);
firstName.contains("first_name", searchValue);
var lastName = new Parse.Query("User");
lastName.limit(1000);
lastName.contains("last_name", searchValue);
var userEmail = new Parse.Query("User");
userEmail.limit(1000);
userEmail.contains("email", searchValue);
var mainQuery = new Parse.Query.or(lastName, firstName, userEmail);
mainQuery.limit(1000);
/*Prepare Parse Query*/
mainQuery.ascending("last_name");
mainQuery.find().then(function(results) {
console.log(results.length);
if (results.length === 0) {
endOfResults = "true"
z = parseInt(z) - 10;
$('body').removeClass('loading');
$('#next-user').addClass('disabled');
} else {
$('body').removeClass('loading');
$('#pagination').hide();
$('#user-pagination tbody tr').remove();
for (var i = 0; i < results.length; i++) {
var object = results[i];
var blockStatus = object.get('suspended');
if (blockStatus === "1") {
blockClass = "unBlockUser";
blockText = "Unblock"
} else {
blockClass = "blockUser";
blockText = "Block"
};
$('#user-pagination tbody').append('<tr><td><a data-object="' + object.id + '" href="' + siteUrl + '/app-users-page/?user=' + object.id + '&blocked=' + blockText + '"">' + object.get('last_name') + '</a></td><td>' + object.get('first_name') + '</td><td>' + object.get('email') + '</td><td><a data-object="' + object.id + '" href="#" class="updatePin">Reset PIN</a> | <a data-object="' + object.id + '" href="#" data-mail="' + object.get('email') + '" data-name="' + object.get('first_name') + ' ' + object.get('last_name') + '" class="' + blockClass + '">' + blockText + '</a> | <a data-object="' + object.id + '" href="#" class="delete-user">Delete</a></td></tr>');
}
}
});
}