Skip to content

Commit

Permalink
Updates limit
Browse files Browse the repository at this point in the history
  • Loading branch information
richmahn committed Apr 11, 2024
1 parent 8ac0689 commit 9faf952
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions js/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ var errorShown = false;
*/
function SearchCriteria() {
/**
* @member {number} matchLimit
* @member {number} limit
* @member {string[]} languages - array of language code strings or null for any language
* @member {string} full_text - text to find in any field (if not null)
* @member {string} user_name - text to find in user_name (if not null)
Expand All @@ -432,7 +432,7 @@ function SearchCriteria() {
* all fields
*/
this.languages = null;
this.matchLimit = MAX_NUMBER_OF_RESULTS_FROM_DB;
this.limit = MAX_NUMBER_OF_RESULTS_FROM_DB;
this.full_text = null;
this.repo_name = null;
this.user_name = null;
Expand Down
36 changes: 18 additions & 18 deletions test/spec/SpecManifestSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Test Manifest Search', function () {
var returned_docClient;
var returned_params;
var returned_retData;
var returned_matchLimit;
var returned_limit;

it('updateResults: err should call alert', function () {
//given
Expand Down Expand Up @@ -240,7 +240,7 @@ describe('Test Manifest Search', function () {
var search_url = 'http://127.0.0.1:4000/en/?lc=en&lc=ceb&q=Bible&user=tx-manager-test-data';
var expectedBaseUrl = 'http://127.0.0.1:4000';
var expectedParams = {
matchLimit: MAX_NUMBER_OF_RESULTS_FROM_DB,
limit: MAX_NUMBER_OF_RESULTS_FROM_DB,
minViews: 0,
languages: [ 'en', 'ceb'],
full_text: 'Bible',
Expand All @@ -259,7 +259,7 @@ describe('Test Manifest Search', function () {
var search_url = 'http://127.0.0.1:4000/en/?lc=en&q=Bible&q=ceb&user=tx-manager-test-data';
var expectedBaseUrl = 'http://127.0.0.1:4000';
var expectedParams = {
matchLimit: MAX_NUMBER_OF_RESULTS_FROM_DB,
limit: MAX_NUMBER_OF_RESULTS_FROM_DB,
minViews: 0,
languages: [ 'en' ],
full_text: 'Bible',
Expand All @@ -278,7 +278,7 @@ describe('Test Manifest Search', function () {
var search_url = 'http://127.0.0.1:4000/en/?lc=es';
var expectedBaseUrl = 'http://127.0.0.1:4000';
var expectedParams = {
matchLimit: MAX_NUMBER_OF_RESULTS_FROM_DB,
limit_RESULTS_FROM_DB,
minViews: 0,
languages: [ 'es' ],
};
Expand All @@ -295,7 +295,7 @@ describe('Test Manifest Search', function () {
var search_url = 'http://127.0.0.1:4000/en/?lc=es&lc=ceb&user=dummy';
var expectedBaseUrl = 'http://127.0.0.1:4000';
var expectedParams = {
matchLimit: MAX_NUMBER_OF_RESULTS_FROM_DB,
limit: MAX_NUMBER_OF_RESULTS_FROM_DB,
minViews: 0,
languages: [ 'es', 'ceb'],
user_name: 'dummy'
Expand All @@ -313,7 +313,7 @@ describe('Test Manifest Search', function () {
var search_url = 'http://127.0.0.1:4000/en/?lc=es&repo=dummy_repo&resource=dummy_res';
var expectedBaseUrl = 'http://127.0.0.1:4000';
var expectedParams = {
matchLimit: MAX_NUMBER_OF_RESULTS_FROM_DB,
limit: MAX_NUMBER_OF_RESULTS_FROM_DB,
minViews: 0,
languages: [ 'es' ],
repo_name: 'dummy_repo',
Expand All @@ -332,7 +332,7 @@ describe('Test Manifest Search', function () {
var search_url = 'http://127.0.0.1:4000/en/?';
var expectedBaseUrl = 'http://127.0.0.1:4000';
var expectedParams = {
matchLimit: MAX_NUMBER_OF_RESULTS_FROM_DB,
limit: MAX_NUMBER_OF_RESULTS_FROM_DB,
minViews: 0,
};

Expand All @@ -348,7 +348,7 @@ describe('Test Manifest Search', function () {
var search_url = 'http://127.0.0.1:4000/en';
var expectedBaseUrl = 'http://127.0.0.1:4000';
var expectedParams = {
matchLimit: MAX_NUMBER_OF_RESULTS_FROM_DB,
limit: MAX_NUMBER_OF_RESULTS_FROM_DB,
minViews: 0,
};

Expand All @@ -366,7 +366,7 @@ describe('Test Manifest Search', function () {
setupDbQueryMocks();
var criteria = new SearchCriteria();
criteria.languages = ['es'];
criteria.matchLimit = 20;
criteria.limit = 20;
expectedErr = null;
expectedData = [{ 'object': "" }];
var expectedSearchKeys = [ 'languages' ];
Expand All @@ -386,7 +386,7 @@ describe('Test Manifest Search', function () {
var criteria = new SearchCriteria();
criteria.languages = ['es', 'ceb'];
criteria.user_name = "dummy";
criteria.matchLimit = 20;
criteria.limit = 20;
expectedErr = null;
expectedData = [];
var expectedSearchKeys = [ 'languages', 'user_name' ];
Expand All @@ -407,7 +407,7 @@ describe('Test Manifest Search', function () {
criteria.repo_name = "dummy_repo";
criteria.resID = "dummy_res";
criteria.returnedFields = "user_name, repo_name";
criteria.matchLimit = 20;
criteria.limit = 20;
expectedErr = null;
expectedData = [];
var expectedSearchKeys = [ 'repo_name', 'resID' ];
Expand All @@ -428,7 +428,7 @@ describe('Test Manifest Search', function () {
criteria.full_text = "dummy_text";
criteria.resType = "dummy_type";
criteria.returnedFields = "user_name, repo_name";
criteria.matchLimit = 20;
criteria.limit = 20;
expectedErr = null;
expectedData = [];
var expectedSearchKeys = [ 'full_text', 'resType' ];
Expand All @@ -451,7 +451,7 @@ describe('Test Manifest Search', function () {
criteria.time = "dummy_time";
criteria.manifest = "dummy_manifest";
criteria.returnedFields = "user_name, repo_name, views";
criteria.matchLimit = 20;
criteria.limit = 20;
expectedErr = null;
expectedData = [];
var expectedSearchKeys = [ 'resType', 'title', 'time', 'manifest' ];
Expand All @@ -470,7 +470,7 @@ describe('Test Manifest Search', function () {
setupDbQueryMocks();
var criteria = new SearchCriteria();
criteria.languages = ['ceb'];
criteria.matchLimit = 2;
criteria.limit = 2;
expectedErr = "search Failure";
expectedData = [ { 'object': "" }];
var expectedSearchKeys = [ 'languages' ];
Expand Down Expand Up @@ -680,7 +680,7 @@ describe('Test Manifest Search', function () {
setupUpdateUrlMock();
spyOn(window, 'updateResults').and.callFake(callback);
spyOn(window, 'searchManifestTable').and.callFake(mockSearchManifestTest);
function mockSearchManifestTest(matchLimit, languages, user_name, repo_name, resID, resType, title, time, manifest, full_text, returnedFields, callback) { // mock the table scan operation
function mockSearchManifestTest(limit, languages, user_name, repo_name, resID, resType, title, time, manifest, full_text, returnedFields, callback) { // mock the table scan operation
if(callback) {
callback(expectedErr, expectedData); // call onScan handler with mock data
}
Expand All @@ -698,12 +698,12 @@ describe('Test Manifest Search', function () {
returnedEntries = entries;
}

function mockSearchContinue(docClient, params, retData, matchLimit, callback){
function mockSearchContinue(docClient, params, retData, limit, callback){
returned_docClient = docClient;
returned_params = params;
returned_retData = retData;
returned_matchLimit = matchLimit;
returned_limit = limit;

originalSearchContinue(docClient, params, retData, matchLimit, callback);
originalSearchContinue(docClient, params, retData, limit, callback);
}
});

0 comments on commit 9faf952

Please sign in to comment.