Filter options list by searchbox results
160439
function(ev) {
            var regex = new RegExp(searchBox.value, 'i'),
                targets = optionsList.querySelectorAll('li');

            for (var i=0; i<targets.length; i++) {
                var target = targets[i];

                // With multiple active options are never shown in the options list, with single
                // we show both the active/inactive options with the active highlighted
                if(multiple && target.classList.contains('active'))
                    continue;

                if(!target.textContent.match(regex)) {
                    target.style.display = 'none';
                } else {
                    target.style.display = 'block';
                }
            };

            searchBox.style.width = ((searchBox.value.length * selected.textWidth) + 25) + 'px';
            moveOptionList();
        }
270008
def process_options(opts):
    """"""
    # Convert match and exclude args into pattern lists
    match = opts.get("match")
    if match and type(match) is str:
        opts["match"] = [pat.strip() for pat in match.split(",")]
    elif match:
        assert type(match) is list
    else:
        opts["match"] = []

    exclude = opts.get("exclude")
    if exclude and type(exclude) is str:
        opts["exclude"] = [pat.strip() for pat in exclude.split(",")]
    elif exclude:
        assert type(exclude) is list
    else:
        # opts["exclude"] = DEFAULT_OMIT
        opts["exclude"] = []
129746
def SearchList(items, message="Select an item:", title='FontParts'):
    
    return dispatcher["SearchList"](items=items, message=message, title=title)
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;
        }
112723
public function searchFilter($searchFilters, $options = [])
    {
        $_options = [];

        $options = array_merge($_options, $options);

        return ($searchFilters ? $this->Search->filterForm($searchFilters) : null);
    }
824375
def filter(self, table, items, filter_string):
        """"""
        query = filter_string.lower()
        return [item for item in items
                if query in item.name.lower()]
510300
public function getFiltered($page, $numRows, $sortAttr, $sortOrder, $searchAttr, $searchValue, $richFilters = [])
    {
        $query = $this->prepareQuery();

        $query = $this->richFiltersOnQuery($query, $richFilters);

        if ($sortAttr && $sortOrder && $this->inScope($sortAttr)) {
            $scope = $this->getScope($sortAttr);
            $query = $query->orderBy($scope, $sortOrder);
        }

        if ($searchAttr && $searchValue && $this->inScope($searchAttr)) {
            $scope = $this->getScope($searchAttr);
            $query = $query->where($scope, 'like', '%' . $searchValue . '%');
        }

        $collection = $query->get();

        $collection = $this->addPermissions($collection);

        $collection = $this->formatCollection($collection);

        $collection = $collection->each(function ($model) {
            $model = $this->formatModel($model);
        });

        if ($sortAttr && $sortOrder && ! $this->inScope($sortAttr)) {
            $collection = $sortOrder == 'asc'
                ? $collection->sortBy($sortAttr)
                : $collection->sortByDesc($sortAttr);
        }

        $collection = $this->richFiltersOnCollection($collection, $richFilters);

        if ($searchAttr && $searchValue && ! $this->inScope($searchAttr)) {
            $collection = $collection->filter(function ($model) use ($searchAttr, $searchValue) {
                $value = (string) $model->$searchAttr;
                $value = strtolower($value);
                $search = strtolower($searchValue);
                return strpos($value, $search) !== false;
            });
        }

        if ($page && $numRows) {
            $toSkip = ($page - 1) * $numRows;
            $count = $collection->count();
            $collection = $collection->take(- ($count - $toSkip))->take($numRows);
        } else if ($numRows)
            $collection = $collection->take($numRows);

        return collect(array_values($collection->toArray()));
    }
1096591
function (sQuery) {
			// add filter for search
			var aFilters = [];
			if (sQuery && sQuery.length > 0) {
				aFilters = new Filter({
					filters: [
						new Filter("name", FilterOperator.Contains, sQuery),
						new Filter("fileType", FilterOperator.Contains, sQuery)
					],
					and: false
				});
			}

			// update list binding
			var oList = this.byId("masterComponentsList");
			var oBinding = oList.getBinding("items");
			oBinding.filter(aFilters, "content");
		}
878593
protected function filter()
    {
        $lists = [
            'listCompetitions',
            'listCountries',
            'listEvents',
            'listEventTypes',
            'listMarketTypes',
            'listVenues',
            'listMarketCatalogue'
        ];

        if (in_array($this->method, $lists) && empty($this->params[ 'filter' ])) {
            $this->params[ 'filter' ] = new \stdClass;
        }
    }
1271291
def search(self, filterstr, attrlist):
        """"""
        return self._paged_search_ext_s(self.settings.BASE, ldap.SCOPE_SUBTREE, filterstr=filterstr,
                                        attrlist=attrlist, page_size=self.settings.PAGE_SIZE)
575244
function(criteria) {
          var results = [];

          criteria = angular.isArray(criteria) ? criteria : [criteria];

          // Search through each
          criteria.forEach(function(q) {
            if(q && q !== '') {

              _listing.forEach(function(item) {
                for(var name in item) {
                  if(item[name].toLowerCase().indexOf(q.toLowerCase()) !== -1 && results.indexOf(item) === -1) {
                    results.push(item);
                  }
                }
              });
            }
          });

          return $q.when(results);
        }
243554
def query_property_filter(query, options)
      if options[:where]
        opts = options[:where]
        if opts[0].is_a?(Array)
          opts.each do |opt|
            query.where(opt[0], opt[1], opt[2]) unless opt.nil?
          end
        else
          query.where(opts[0], opts[1], opts[2])
        end
      end
      query
    end
1052537
def custom_filter_tags(self, value, search):
        """"""
        if not isinstance(value, list):
            value = value.split(',')

        filters = [Q('match', **{'tags': item}) for item in value]
        search = search.query('bool', must=filters)

        return search
1029413
def filter(self, table, mappings, filter_string):
        """"""
        q = filter_string.lower()
        return [mapping for mapping in mappings
                if q in mapping.ud.lower()]
1337359
function filter(rows = [], filters = [], filterText, columns) {
  let filteredRows = rows.slice(0);
  if (filters.length === 0 && !filterText) {
    return filteredRows;
  }

  const textFilters = [
    ...(filterText ? [filterText.toLowerCase()] : []),
    ...filters.filter(f => f.textFilter).map(f => f.value),
  ];

  const valueFilters = filters.filter(f => f.valueFilter);

  // apply text filters across all columns
  if (textFilters.length > 0) {
    filteredRows = _.filter(rows, row => _.some(columns, (column) => {
      if (!column.searchable) {
        return false;
      }
      const normalized = String(_.get(row, column.key)).toLowerCase();
      return _.every(textFilters, f => normalized.indexOf(f) > -1);
    }));
  }

  // apply value filters on filterable columns
  if (valueFilters.length > 0) {
    const groups = _.groupBy(valueFilters, 'key');
    filteredRows = _.filter(filteredRows, row => _.every(
      groups,
      (groupFilters, groupKey) => {
        const value = _.get(row, groupKey);
        return _.some(groupFilters, f => f.value === value);
      }
    ));
  }

  return filteredRows;
}
864103
def _create_search_filter(filter_by):
        
        return ",".join(
            [
                "{0}:{1}".format(key, value)
                for key, value in filter_by.items()
                if value is not None
            ]
        )
195260
def get_choices(cls, condition=None, order_by=None, query=None, value_field=None, text_field=None):
        
        result = []
        if query is None:
            query = cls.filter(condition).order_by(order_by)
        for row in query:
            if not value_field:
                value = row._key
            else:
                value = getattr(row, value_field)
            if not text_field:
                text = unicode(row)
            else:
                text = getattr(row, text_field)
            result.append((value, text))
        return result