*** Private helper functions *** Handles the search event
497715
function(oThis, oEvent){
		oThis._sSearchQuery = oEvent.getParameter("query"); //Store the value until next Search
		oThis.fireSearch({query: oThis._sSearchQuery});
		oThis._bDetailsVisible = true;
		oThis.invalidate();
	}
632776
function () {
            var selected;
            if (this.isPlaceholderOptionSelected()) {
                this.updateSelection(null);
                this.close();
                this.setPlaceholder();
            } else {
                var self = this;
                this.opts.initSelection.call(null, this.opts.element, function(selected){
                    if (selected !== undefined && selected !== null) {
                        self.updateSelection(selected);
                        self.close();
                        self.setPlaceholder();
                        self.nextSearchTerm = self.opts.nextSearchTerm(selected, self.search.val());
                    }
                });
            }
        }
756064
function searchBar_focus(event)
  {
    var input = this.getElement({type: "searchBar_input"});

    switch (event.type) {
      case "click":
        this._controller.click(input);
        break;
      case "shortcut":
        if (mozmill.isLinux) {
          var cmdKey = utils.getEntity(this.getDtds(), "searchFocusUnix.commandkey");
        } else {
          var cmdKey = utils.getEntity(this.getDtds(), "searchFocus.commandkey");
        }
        this._controller.keypress(null, cmdKey, {accelKey: true});
        break;
      default:
        throw new Error(arguments.callee.name + ": Unknown element type - " + event.type);
    }

    // Check if the search bar has the focus
    var activeElement = this._controller.window.document.activeElement;
    this._controller.assertJS("subject.isFocused == true",
                              {isFocused: input.getNode() == activeElement});
  }
497060
function searchFormKeyDown(e){
    e = e || window.event;

    // 27 = escape, so hide the form
    if(e.keyCode == 27){
      document.body.removeChild(document.getElementById('search'));
      searchBoxShown = false;

    // 40 = down arrow, select the next item
    }else if(e.keyCode == 40){
      selectNextItem();
      e.preventDefault();
      e.stopPropagation();
      return false;

    // 38 = up arrow, select the previous item
    }else if(e.keyCode == 38){
      selectPreviousItem();
      e.preventDefault();
      e.stopPropagation();
      return false;

    // Most likely a letter typed or deleted in the search box.
    // So queue another search
    }else{
      clearTimeout(searchingTimeout);
      searchingTimeout = setTimeout(doSearch, 150);
    }
  }
642950
function checkEnterOnSearch(e,refs){var val=e.target.value;if(val&&val!==''){var res=[];var selected=this.getSelected();var matches=this.search.isThereAnythingRelatedTo(val);matches.forEach(function(el){var index=el.i;el=refs.selectOptions[index];if(selected.indexOf(el)===-1){res.push(el);}});// If only one result is available, select that result.
// If more than one results, select one only on exact match.
var selectedIndex=-1;if(res.length===1){selectedIndex=0;}else if(res.length>1){for(var i=0;i<res.length;i++){if(res[i].text.toUpperCase()===val.toUpperCase()){selectedIndex=i;break;}}}if(selectedIndex!=-1){var el=res[selectedIndex];if(!el.disabled){this.setByIndex(el.index,this.multiple);if(this.multipleTags){setTimeout(function(){return refs.search.focus();},200);}if(this.onChange){try{this.onChange(e,this.getSelectedValues());}catch(e){console.warn('something may be wrong in "onChange"',e);}}}}return res;}return false;}
390527
function clearSearchText () {
    // Set the loading to true so we don't see flashes of content.
    // The flashing will only occur when an async request is running.
    // So the loading process will stop when the results had been retrieved.
    setLoading(true);

    $scope.searchText = '';

    // Normally, triggering the change / input event is unnecessary, because the browser detects it properly.
    // But some browsers are not detecting it properly, which means that we have to trigger the event.
    // Using the `input` is not working properly, because for example IE11 is not supporting the `input` event.
    // The `change` event is a good alternative and is supported by all supported browsers.
    var eventObj = document.createEvent('CustomEvent');
    eventObj.initCustomEvent('change', true, true, { value: '' });
    elements.input.dispatchEvent(eventObj);

    // For some reason, firing the above event resets the value of $scope.searchText if
    // $scope.searchText has a space character at the end, so we blank it one more time and then
    // focus.
    elements.input.blur();
    $scope.searchText = '';
    elements.input.focus();
  }
925951
function triggerDropdownAutocomplete(){
                // First check with the autocomplete words (the ones that are not objects
                var autocomplete = [],
                    suggestions = [],
                    text = $scope.areaData,
                    position = getCharacterPosition(),
                    lastWord = text.substr(0, position).split(/[\s\b{}]/);

                // Get the last typed word
                lastWord = lastWord[lastWord.length-1];

                $scope.areaConfig.autocomplete.forEach(function(autoList){
                    autoList.words.forEach(function(word){
                        if(typeof(word) === 'string' && autocomplete.indexOf(word) < 0){
                            if(lastWord.length > 0 || lastWord.length < 1 && autoList.autocompleteOnSpace){
                                autocomplete.push(word);
                            }
                        }
                    });
                });

                if ($scope.areaConfig.dropdown !== undefined){
                    $scope.areaConfig.dropdown.forEach(function(element){
                        if(typeof(element.trigger) === 'string' && autocomplete.indexOf(element.trigger) < 0){
                            autocomplete.push(element.trigger);
                        }
                    });
                }

                // Now with the list, filter and return
                autocomplete.forEach(function(word){
                    if(lastWord.length < word.length && word.toLowerCase().substr(0, lastWord.length) === lastWord.toLowerCase()){
                        suggestions.push({
                            display: $sce.trustAsHtml(word),
                            data: null
                        });
                    }
                });

                $scope.dropdown.customSelect = null;
                $scope.dropdown.current = 0;
                $scope.dropdown.content = suggestions;
            }
295865
function search(query, cols, max) {
    var url;
    var token = cache.get('token');
    var cases;
    var fields;
    var dfrd = Q.defer();

    function extractCases(xml) {
      var r = _parse(xml, dfrd);
      if (!r ||
        !r.response ||
        !r.response.cases ||
        !r.response.cases.length ||
        !r.response.cases[0].case) {
        return dfrd.reject(MODULE_ERRORS.bugNotFound);
      }
      cases = r.response.cases[0].case.map(function(kase) {
        var bug = new Case({
          id: kase.$.ixBug,
          operations: kase.$.operations.split(','),
          title: kase.sTitle[0].trim(),
          status: kase.sStatus[0].trim(),
          url: format('%s://%s/default.asp?%s', PROTOCOL, conf.host,
            kase.$.ixBug),
          fixFor: kase.sFixFor[0].trim()
        });
        if (kase.sPersonAssignedTo) {
          bug.assignedTo = kase.sPersonAssignedTo[0].trim();
          bug.assignedToEmail = kase.sEmailAssignedTo[0].trim();
        }
        if (kase.tags && kase.tags[0].tag) {
          bug.tags = kase.tags[0].tag.join(', ');
        }
        // find anything leftover in the case, disregarding the fields we
        // already
        _(kase)
          .keys()
          .difference(_.keys(bug).concat('sTitle', 'sStatus', '$',
            'sFixFor', 'sPersonAssignedTo',
            'sEmailAssignedTo'))
          .each(function(key) {
            var value = kase[key];
            bug[key] = _.isArray(value) && value.length === 1 ?
              // dereference
              bug[key] = value[0].trim() :
              value;
          });
        bug._raw = kase;
        return bug;
      });
      if (cases.length > 1) {
        return cases;
      }
      return cases[0];
    }

    fields = (cols || DEFAULT_COLS).join(',');
    max = max || DEFAULT_MAX;
    query = encodeURIComponent(query);
    if (!token) {
      dfrd.reject(MODULE_ERRORS.undefinedToken);
    } else {
      url = format(URLs.search, PROTOCOL, conf.host, query, fields, max,
        token);
      request(url, function(err, res, body) {
        var newCases;
        if (err) {
          dfrd.reject(err);
        } else {
          newCases = extractCases(body);
          if (!newCases) {
            console.error(body);
            dfrd.reject(MODULE_ERRORS.unknown);
          } else {
            dfrd.resolve(newCases);
          }
        }
      });
    }
    return dfrd.promise;
  }
843685
function setSearch(uri) {
  if (typeof uri.search === 'string' || uri.query === undefined) return;

  if (typeof uri.query === 'string') {
    uri.search = '?' + uri.query;
    return;
  }

  var name, filled = false;
  uri.search = '?';

  for (name in uri.query) {
    filled = true;
    uri.search += name + '=' + uri.query[name] + '&';
  }

  uri.search = uri.search.substr(0, uri.search.length - 1);
}
1033223
function InlineSearchResultExplorer(registry, commandService, inlineSearchPane, preferences, fileClient, searcher) {
        this.registry = registry;
        this._commandService = commandService;
        this.fileClient = fileClient;
        this.defaulRows = 40;
		this._contentTypeService = new mContentTypes.ContentTypeRegistry(this.registry);
		this._inlineSearchPane = inlineSearchPane;
		this._preferences = preferences;
		this._searcher = searcher;
		this._replaceRenderer =  new SearchResultRenderer({
            checkbox: true,
            highlightSelection: false,
            getCheckedFunc: function(item) {
                return this.getItemChecked(item);
            }.bind(this),
            onCheckedFunc: function(rowId, checked, manually) {
                this.onRowChecked(rowId, checked, manually);
            }.bind(this)
        }, this);
        this.render = this._normalRenderer = new SearchResultRenderer({
            checkbox: false,
            highlightSelection: false
        }, this);
    	mFileDetailRenderer.getPrefs(this._preferences, "/inlineSearchPane", ["showFullPath", "viewByFile", "hidePerfectMatch", "hideNonMatch", "hidePossibleMatch"]).then(function(properties){ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
    		this._shouldShowFullPath = properties ? properties[0] : false;
    		this._viewByFile = properties ? properties[1] : false;
    		this._matchFilter = {};
    		this._matchFilter["hidePerfectMatch"] = {flag: properties ? properties[2] : false,
    												 filterFunc: function(confidence, hide) {
    												 	return !hide && confidence === 100;
    												 }};
    		this._matchFilter["hideNonMatch"] = {flag: properties ? properties[3] : false,
    												 filterFunc: function(confidence, hide) {
    												 	return !hide && confidence === 0;
    												 }};
    		this._matchFilter["hidePossibleMatch"] = {flag: properties ? properties[4] : false,
    												 filterFunc: function(confidence, hide) {
    												 	return !hide && confidence !== 100 && confidence !== 0;
    												 }};
    		this.declareCommands();
     	}.bind(this));
    }
911918
function()
    {
        if (!this._searchResults || !this._searchResults.length)
            return;
        var index = this._selectedSearchResult ? this._searchResults.indexOf(this._selectedSearchResult) : -1;
        this._jumpToSearchResult(index + 1);
    }
84060
function submitSearch() {
    var searchInput = getSearchInput();
    // FIXME: SUI validation for select2 field
      if (!searchInput.valid) {
      alert('Please select team members');
      return;
    }
    console.log('publishing', searchInput);
    $('.search.message').html('Search results:');
    $('.search.message').removeClass('hidden');
    context.pubsub.status('queued', function(res) {
      console.log(res);
      var message = '';
      if (res.err) {
        message = res.err;
      } else {
        message = 'found <a target="_searchresult" href="' + res.status.uri + '">' + res.status.uri + '</a> from ' + res.status.source;
      }

      $('.search.message').append('<div>' + message + '</div>');
    });

    context.pubsub.search.queue(searchInput);
    context.queryLib.setAnnotationTags($('#searchCategories').val().split(','));
    context.queryLib.submitQuery();
  }
914179
function onSearchEnd(result) {
    if ((! pendingRangeRetrievals) && (pendingReferrals.length <= 0)) {
      client.unbind();
      log.info('Active directory search (%s) for "%s" returned %d entries.',
               baseDN, truncateLogOutput(opts.filter),
               (results || []).length);
      if (callback) callback(null, results);
    }
  }
646056
public void onSearchDone(SearchEvent event) {
		if (featureListTable != null) {
			featureListTable.setLayer(event.getLayer());
			for (Feature feature : event.getFeatures()) {
				featureListTable.addFeature(feature);
			}
		}
		afterSearch();
	}
92053
function(query, options) {
            var nresults = 0, content;

            // Define options
            options = _.defaults(options || {}, {
                silent: false,
                caseSensitive: false
            });

            query = options.caseSensitive ? query : query.toLowerCase();

            nresults = this.filter(function(model, item) {
                content = this.options.searchAttribute != null ? model.get(this.searchAttribute, "") : item.$el.text();
                content = options.caseSensitive ? content : content.toLowerCase();
                return content.search(query) >= 0;
            }, this);

            if (!options.silent) this.trigger("search", {
                query: query,
                n: nresults
            });

            return this;
        }
228402
function (search) {
    if (!this.section) this.render();

    var el = noselector(this.section.getChildNodes());

    if (arguments.length) {
      return el.find(search).andSelf().filter(search);
    }

    return el;
  }
677237
function handleKeypress( e ) {
        if ( e.keyCode !== 38 && e.keyCode !== 40 && e.keyCode !== 13 ) {
            return;
        }

        var $this = $( this );
        var isInput = $this.is( ".bselect-search-input" );

        switch ( e.keyCode ) {
            // UP
            case 38:
                if ( isInput ) {
                    $( e.delegateTarget ).find( ".bselect-option:visible:last" ).focus();
                } else {
                    $this.prevAll( ".bselect-option:visible" ).eq( 0 ).focus();
                }
                break;

            // DOWN
            case 40:
                if ( isInput ) {
                    $( e.delegateTarget ).find( ".bselect-option:visible:first" ).focus();
                } else {
                    $this.nextAll( ".bselect-option:visible" ).eq( 0 ).focus();
                }
                break;

            // ENTER
            case 13:
                if ( !isInput ) {
                    $this.trigger( "click" );
                }
                break;
        }

        return false;
    }