Support general query using the 'text' attribute.
166546
def custom_filter_text(self, value, search):
        """"""
        if isinstance(value, list):
            value = ' '.join(value)

        should = [
            Q('match', slug={'query': value, 'operator': 'and', 'boost': 10.0}),
            Q('match', **{'slug.ngrams': {'query': value, 'operator': 'and', 'boost': 5.0}}),
            Q('match', name={'query': value, 'operator': 'and', 'boost': 10.0}),
            Q('match', **{'name.ngrams': {'query': value, 'operator': 'and', 'boost': 5.0}}),
            Q('match', contributor_name={'query': value, 'operator': 'and', 'boost': 5.0}),
            Q('match', **{'contributor_name.ngrams': {'query': value, 'operator': 'and', 'boost': 2.0}}),
            Q('match', owner_names={'query': value, 'operator': 'and', 'boost': 5.0}),
            Q('match', **{'owner_names.ngrams': {'query': value, 'operator': 'and', 'boost': 2.0}}),
            Q('match', descriptor_data={'query': value, 'operator': 'and'}),
        ]

        # Add registered text extensions.
        for extension in composer.get_extensions(self):
            if hasattr(extension, 'text_filter'):
                should += extension.text_filter(value)

        search = search.query('bool', should=should)

        return search
796836
def fmt_text(text, bg = None, fg = None, attr = None, plain = False):
        
        if not plain:
            if fg is not None:
                text = TEXT_FORMATING['fg'][fg] + text
            if bg is not None:
                text = TEXT_FORMATING['bg'][bg] + text
            if attr is not None:
                text = TEXT_FORMATING['attr'][attr] + text
            if (fg is not None) or (bg is not None) or (attr is not None):
                text += TEXT_FORMATING['rst']
        return text
699889
def query(self):
        """"""
        self._query = query = ""

        query_kwargs = self.query_kwargs
        if query_kwargs: query = urlencode(query_kwargs, doseq=True)
        return query
659616
def refer(self, text):
        
        data = self.reply(text)
        data['refer_key'] = self['key']
        return data
5630
def _simpleQuery(self, query):
        
        cur = self._conn.cursor()
        cur.execute(query)
        row = cur.fetchone()
        return util.parse_value(row[0])
643271
def _(text, *args, **kwargs):
    """"""
    msg = _t.gettext(text)
    if args or kwargs:
        return msg.format(*args, **kwargs)
    else:
        return msg
500859
def search(query):
    
    params = {
        's.cmd': 'setTextQuery(%s)setPageSize(50)setHoldingsOnly(true)' % query
    }
    return requests.get(BASE_URL, params=params, timeout=10).json()
770640
def _filter(self, text):
        """"""

        if self.urls:
            text = RE_LINK.sub('', text)
        if self.emails:
            text = RE_MAIL.sub('', text)
        return text
788169
def find(cls, text):
        """"""
        if isinstance(cls.pattern, string_types):
            cls.pattern = re.compile(cls.pattern)
        return cls.pattern.finditer(text)
786586
def get_texts_box(texts, fs):
    """"""
    max_len = max(map(len, texts))
    return (fs, text_len(max_len, fs))
1105548
def autocomplete_query(self, **kwargs):
        
        if not kwargs.get('text'):
            raise ValueError('Valid text (parameter "text") must be provided.')

        return self._query(AUTOCOMPLETE_API_URL, **kwargs)
805398
def query(self, base, filterstr, attrlist=None):
		
		return self.conn.search_s(base, ldap.SCOPE_SUBTREE, filterstr, attrlist)
624534
def _querystring(self):
        """"""

        kw = {}
        for key in self.KNOWN_QUERY_OPTIONS:
            val = getattr(self, key)
            if val is not None:
                kw[key] = val
        return kw
1154859
def keyword(self, text):
        """"""
        cls = self.KEYWORDS[text]
        self.push_token(cls(text, self.lineno, self.offset))
686835
def text(self, prompt, default=None):
        """"""
        prompt = prompt if prompt is not None else 'Enter some text'
        prompt += " [{0}]: ".format(default) if default is not None else ': '
        return self.input(curry(filter_text, default=default), prompt)
897424
def text(self, value):
        """"""
        if value in (None, '') or value.strip() == "":
            raise AttributeError("Empty text value is invalid.")
        self._text = value
1291068
def query(self):
        """"""
        if self._query is None:
            query_string = self.environ.get('QUERY_STRING')
            self._query = QueryDict([
                (k.decode('utf-8'), v.decode('utf-8'))
                for k, v in urlparse.parse_qsl(
                    query_string, keep_blank_values=True)
            ])
        return self._query