Is the Query blank? (ie, should we not bother searching?)
 A query is considered blank if its text is nil or empty string AND
 no URL parameters are specified.
167442
def blank?
      !params_given? and (
        (text.is_a?(Array) and text.compact.size < 2) or
        text.to_s.match(/\A\s*\z/)
      )
    end
108097
def _compile_query(self):
        
        # https://wiki.apache.org/solr/SolrQuerySyntax
        # http://lucene.apache.org/core/2_9_4/queryparsersyntax.html
        query = []

        # filtered_query = self._model_class.row_level_access(self._current_context, self)
        # if filtered_query is not None:
        #     self._solr_query += filtered_query._solr_query
        # print(self._solr_query)
        for key, val, is_escaped in self._solr_query:
            # querying on a linked model by model instance
            # it should be a Model, not a Node!
            if key == 'key':
                key = '_yz_rk'
            elif key == '-key':
                    key = '-_yz_rk'
            elif key[:5] == 'key__':  # to handle key__in etc.
                key = '_yz_rk__' + key[5:]
            elif key[:6] == '-key__':  # to handle key__in etc.
                key = '-_yz_rk__' + key[6:]

            key, val, is_escaped = self._process_query_val(key, val, is_escaped)
            # if it's not one of the expected objects, it should be a string
            # if key == "OR_QRY" then join them with "OR" after escaping & parsing
            if key == 'OR_QRY':
                key = 'NOKEY'
                val = ' OR '.join(
                    ['%s:%s' % self._parse_query_key(*self._process_query_val(k, v, is_escaped)) for
                     k, v in val.items()])
                is_escaped = True
            # __in query is same as OR_QRY but key stays same for all values
            elif key.endswith('__in'):
                if not val:
                    raise ValueError("query value list can not be empty for __in query, "
                                     "please check if it is empty or not before execute filter.")
                key = key[:-4]
                val = ' OR '.join(
                    ['%s:%s' % (key, self._escape_query(v, is_escaped)) for v in val])
                if key.startswith('-'):
                    val = '*:* %s' % val
                key = 'NOKEY'
                is_escaped = True
            # parse the query
            key, val = self._parse_query_key(key, val, is_escaped)

            # as long as not explicitly asked for,
            # we filter out records with deleted flag
            if key == 'deleted':
                self.want_deleted = True
            # convert two underscores to dot notation
            key = key.replace('__', '.')
            # NOKEY means we already combined key partition in to "val"
            if key == 'NOKEY':
                query.append("(%s)" % val)
            else:
                query.append("%s:%s" % (key, val))

        # need to add *:* for negative queries, if
        # query has only one criteria, such as:
        # (-name:Jack) AND -deleted:True
        # this wont work properly, it must be altered as
        # (*:* -name:Jack) AND -deleted:True
        if len(query) == 1:
            q = query[0]
            if q.startswith('-'):
                query[0] = '*:* %s' % q
            if q[:2] == '(-':
                query[0] = '( *:* %s' % q[1:]

        # filter out "deleted" fields if not user explicitly asked for

        # join everything with "AND"
        joined_query = self._QUERY_GLUE.join(query)
        if not self.want_deleted:
            if joined_query:
                joined_query = "(%s) AND -deleted:True" % joined_query
            else:
                joined_query = '-deleted:True'
        elif not joined_query:
            joined_query = '*:*'
        self.compiled_query = joined_query
621218
def visit_link?(link, from_page = nil)
      !@pages.has_page?(link) &&
      !skip_link?(link) &&
      !skip_query_string?(link) &&
      allowed(link) &&
      !too_deep?(from_page)
    end
1110471
def get_query_params
      out = {}
      search_attributes.each do |val|
        out[val.field]=self.send(val.field) unless self.send(val.field).blank?
      end

      out
    end
1118594
def search(query = nil, provider = nil, sort = nil, order = nil, limit = nil, page = nil)
      params = {
        q: query,
        provider: provider,
        sort: sort,
        order: order,
        limit: limit,
        page: page
      }.delete_if { |_, v| v.nil? }

      @client.request('get', '/search', params)
    end
967401
function parseQuery() {
  let query = {};

  try { query = JSON.parse(queryBox.value); }
  catch(error) {
    queryError.textContent = 'Query must be valid JSON';
    hide(queryButton);
    hide(queryResults);
    show(queryError);
    return null;
  } 

  hide(queryError);
  show(queryButton);
  return query;
}
551187
def _accept_as_blank(self, url_info: URLInfo):
        ''''''
        _logger.debug(__('Got empty robots.txt for {0}.', url_info.url))
        self._robots_txt_pool.load_robots_txt(url_info, '')
1006851
function (query, string, exact) {
        if (typeof string !== 'string' || string === '') {
          return false;
        }
        if (exact) {
          return string.toLowerCase() === query.toLowerCase();
        }
        return string.toLowerCase().indexOf(query.toLowerCase()) !== -1;
      }
1343716
def url_parse_query (query, encoding=None):
    """"""
    if isinstance(query, unicode):
        if encoding is None:
            encoding = url_encoding
        query = query.encode(encoding, 'ignore')
    # if ? is in the query, split it off, seen at msdn.microsoft.com
    append = ""
    while '?' in query:
        query, rest = query.rsplit('?', 1)
        append = '?'+url_parse_query(rest)+append
    l = []
    for k, v, sep in parse_qsl(query, keep_blank_values=True):
        k = url_quote_part(k, '/-:,;')
        if v:
            v = url_quote_part(v, '/-:,;')
            l.append("%s=%s%s" % (k, v, sep))
        elif v is None:
            l.append("%s%s" % (k, sep))
        else:
            # some sites do not work when the equal sign is missing
            l.append("%s=%s" % (k, sep))
    return ''.join(l) + append
1112167
def validate_query(query):
        
        tokens = _quote_re.findall(query)
        for token in tokens:
            if token.startswith('"') and token.endswith('"'):
                continue
            if set(token) & _invalid_ascii:
                return False
        return True
290539
def blank?(value)
      value.nil? ||
      value.respond_to?(:empty?) && value.empty? ||
      BLANK_REGEX === value
    end
1164550
def matches? query
      query.reduce(true) do |matches, (key, value)|
        matches = if key == 'tag'
          return false unless tags.present?
          tags.include? value
        else
          attributes[key] == value
        end
      end
    end
63704
function isSearchable() {
    if (ctrl.loading && !hasMatches()) {
      // No query when query is in progress.
      return false;
    } else if (hasSelection()) {
      // No query if there is already a selection
      return false;
    }
    else if (!hasFocus) {
      // No query if the input does not have focus
      return false;
    }
    return true;
  }
1123319
def query(self, query=None):
        
        if query is None:
            return self.url.query
        self.url.query = query
1127153
def is_empty(self, resource):
        
        args = self._es_args(resource)
        res = self.elastic(resource).count(body={'query': {'match_all': {}}}, **args)
        return res.get('count', 0) == 0
40281
def view_exists?(query)
      if query.nil?
        raise ArgumentError, 'Query cannot be nil'
      end

      result = query(query)

      !result.empty?
    end
987880
def query_keywords_empty(kind='1'):
        '''
        
        '''
        return TabPost.select().where((TabPost.kind == kind) & (TabPost.keywords == ''))