[Search] Cleanup

Removed a couple of unnecissary things, and fixed
up the comments.
This commit is contained in:
shale 2015-07-21 15:04:50 -07:00
parent 7934e8d425
commit 416bd82589
5 changed files with 11 additions and 17 deletions

View File

@ -42,7 +42,7 @@
"provides": "searchService",
"type": "provider",
"implementation": "providers/GenericSearchProvider.js",
"depends": [ "$rootScope", "$timeout", "objectService", "workerService" ]
"depends": [ "$rootScope", "objectService", "workerService" ]
},
{
"provides": "searchService",

View File

@ -146,10 +146,6 @@ define(
providers[i].query(inputID, timestamp, DEFAULT_MAX_RESULTS, DEFUALT_TIMEOUT);
}
// TODO: Then we want to 'Get the latest results from all the providers'
// And then we might also want to check to see if the timestamp
// is correct.
// Update the merged results list
updateResults();
}

View File

@ -36,18 +36,17 @@ define(
DEFAULT_MAX_RESULTS = 100;
/**
* A model service which reads domain object models from an external
* persistence service.
* A search service which searches through domain objects in
* the filetree using ElasticSearch.
*
* @constructor
* @param {PersistenceService} persistenceService the service in which
* domain object models are persisted.
* @param $q Angular's $q service, for working with promises
* @param {string} SPACE the name of the persistence space from which
* models should be retrieved.
* @param $http Angular's $http service, for working with urls
* @param {ObjectService} objectService the service from which
* domain objects can be gotten.
* @param ROOT the constant ELASTIC_ROOT which allows us to
* interact with ElasticSearch.
*/
function ElasticsearchSearchProvider($http, objectService, ROOT) {
// TODO: Fix the above docstring
// Check to see if the input has any special options
function isDefaultFormat(searchTerm) {

View File

@ -43,7 +43,7 @@ define(
* @param {WorkerService} workerService the service which allows
* more easy creation of web workers.
*/
function GenericSearchProvider($rootScope, $timeout, objectService, workerService) {
function GenericSearchProvider($rootScope, objectService, workerService) {
var worker = workerService.run('genericSearchWorker'),
latestResults = [],
lastSearchTimestamp = 0;
@ -94,7 +94,6 @@ define(
lastSearchTimestamp = event.data.timestamp;
});
}
// If the message was from 'index', we don't need to do anything
}
// Recursive helper function for getItems()

View File

@ -75,6 +75,7 @@
while (terms.substr(terms.length - 1, 1) === ' ') {
terms = terms.substring(0, terms.length - 1);
}
// Then split it at the spaces
terms = terms.split(' ');
console.log('terms', terms);
@ -153,8 +154,7 @@
self.onmessage = function (event) {
if (event.data.request === 'index') {
// TODO: Don't really need to post here.
self.postMessage(index(event.data));
index(event.data);
} else if (event.data.request === 'search') {
self.postMessage(search(event.data));
}