bundles/org.eclipse.orion.client.ui/web/orion/crawler/searchCrawler.js
function SearchCrawler(	serviceRegistry, fileClient, searchParams, options) {
		this.registry= serviceRegistry;
		this.fileClient = fileClient; 
		this.fileLocations = [];
		this.fileSkeleton = [];
		this._hitCounter = 0;
		this._totalCounter = 0;
		this._searchOnName = options && options.searchOnName;
		this._buildSkeletonOnly = options && options.buildSkeletonOnly;
		this._fetchChildrenCallBack = options && options.fetchChildrenCallBack;
		this._searchParams = searchParams;
		this.searchHelper = (this._searchOnName || this._buildSkeletonOnly || !this._searchParams) ? null: mSearchUtils.generateSearchHelper(searchParams);
		this._location = searchParams ? searchParams.resource : options && options.location;
		this._childrenLocation = options && options.childrenLocation ? options.childrenLocation : this._location;   
		this._reportOnCancel = options && options.reportOnCancel;
		this._visitSingleFile = options && options.visitSingleFile;
		if(!this._visitSingleFile) {
			this._visitSingleFile = this._searchSingleFile;
		}
		this._cancelMessage = options && options.cancelMessage;
		if(!this._cancelMessage) {
			this._cancelMessage = messages["searchCancelled"];
		}
		this._cancelled = false;
		this._statusService = this.registry.getService("orion.page.message"); //$NON-NLS-0$
		this._progressService = this.registry.getService("orion.page.progress"); //$NON-NLS-0$
		if(this._statusService) {
			this._statusService.setCancelFunction(function() {this._cancelFileVisit();}.bind(this));
		}
	}
function SearchCrawler(	serviceRegistry, fileClient, searchParams, options) {
		this.registry= serviceRegistry;
		this.fileClient = fileClient; 
		this.fileLocations = [];
		this.fileSkeleton = [];
		this._hitCounter = 0;
		this._totalCounter = 0;
		this._searchOnName = options && options.searchOnName;
		this._buildSkeletonOnly = options && options.buildSkeletonOnly;
		this._fetchChildrenCallBack = options && options.fetchChildrenCallBack;
		this._searchParams = searchParams;
		this.searchHelper = (this._searchOnName || this._buildSkeletonOnly || !this._searchParams) ? null: mSearchUtils.generateSearchHelper(searchParams);
		this._location = searchParams ? searchParams.resource : options && options.location;
		this._childrenLocation = options && options.childrenLocation ? options.childrenLocation : this._location;   
		this._reportOnCancel = options && options.reportOnCancel;
		this._visitSingleFile = options && options.visitSingleFile;
		if(!this._visitSingleFile) {
			this._visitSingleFile = this._searchSingleFile;
		}
		this._cancelMessage = options && options.cancelMessage;
		if(!this._cancelMessage) {
			this._cancelMessage = messages["searchCancelled"];
		}
		this._cancelled = false;
		this._statusService = this.registry.getService("orion.page.message"); //$NON-NLS-0$
		this._progressService = this.registry.getService("orion.page.progress"); //$NON-NLS-0$
		if(this._statusService) {
			this._statusService.setCancelFunction(function() {this._cancelFileVisit();}.bind(this));
		}
	}
function SearchCrawler ( serviceRegistry , fileClient , searchParams , options ) { this . registry = serviceRegistry ; this . fileClient = fileClient ; this . fileLocations = [ ] ; this . fileSkeleton = [ ] ; this . _hitCounter = 0 ; this . _totalCounter = 0 ; this . _searchOnName = options && options . searchOnName ; this . _buildSkeletonOnly = options && options . buildSkeletonOnly ; this . _fetchChildrenCallBack = options && options . fetchChildrenCallBack ; this . _searchParams = searchParams ; this . searchHelper = ( this . _searchOnName || this . _buildSkeletonOnly || ! this . _searchParams ) ? null : mSearchUtils . generateSearchHelper ( searchParams ) ; this . _location = searchParams ? searchParams . resource : options && options . location ; this . _childrenLocation = options && options . childrenLocation ? options . childrenLocation : this . _location ; this . _reportOnCancel = options && options . reportOnCancel ; this . _visitSingleFile = options && options . visitSingleFile ; if ( ! this . _visitSingleFile ) { this . _visitSingleFile = this . _searchSingleFile ; } this . _cancelMessage = options && options . cancelMessage ; if ( ! this . _cancelMessage ) { this . _cancelMessage = messages [ "searchCancelled" ] ; } this . _cancelled = false ; this . _statusService = this . registry . getService ( "orion.page.message" ) ; //$NON-NLS-0$ this . _progressService = this . registry . getService ( "orion.page.progress" ) ; //$NON-NLS-0$ if ( this . _statusService ) { this . _statusService . setCancelFunction ( function ( ) { this . _cancelFileVisit ( ) ; } . bind ( this ) ) ; } }
SearchCrawler is an alternative when a file service does not provide the search API.
It assumes that the file client at least provides the fetchChildren and read APIs.
It basically visits all the children recursively under a given directory location and search on a given keyword, either literal or wild card.
@param {serviceRegistry} serviceRegistry The service registry.
@param {fileClient} fileClient The file client that provides fetchChildren and read APIs.
@param {Object} searchParams The search parameters.
@param {Object} options Not used yet. For future use.
@name orion.search.SearchCrawler
SearchCrawler is an alternative when a file service does not provide the search API . It assumes that the file client at least provides the fetchChildren and read APIs . It basically visits all the children recursively under a given directory location and search on a given keyword either literal or wild card .