Search for hashes
        
        :type searchterm: str
        :rtype: list
493188
def search_hash(self, searchterm):
        
        return self.__search(type_attribute=self.__misphashtypes(), value=searchterm)
771459
def search_registry(self, searchterm):
        
        return self.__search(type_attribute=self.__mispregistrytypes(), value=searchterm)
864921
def __search(self, value, type_attribute):
        
        results = []
        if not value:
            raise EmptySearchtermError
        for idx, connection in enumerate(self.misp_connections):
            misp_response = connection.search(type_attribute=type_attribute, values=value)

            # Fixes #94
            if isinstance(self.misp_name, list):
                name = self.misp_name[idx]
            else:
                name = self.misp_name

            results.append({'url': connection.root_url,
                            'name': name,
                            'result': self.__clean(misp_response)})
        return results
574647
def match(self, s):
      
      self.matches = self.re.search(s)
      return self.matches
718597
def query(self, search, query):
        '''
        
        '''
        if not query:
            return search

        included, excluded = [], []
        for term in query.split(' '):
            if not term.strip():
                continue
            if term.startswith('-'):
                excluded.append(term[1:])
            else:
                included.append(term)
        if included:
            search = search.query(self.multi_match(included))
        for term in excluded:
            search = search.query(~self.multi_match([term]))
        return search
290761
def _do_search(self):
        
        if self._results_cache is None:
            response = self.raw()
            results = self.to_python(response.get('hits', {}).get('hits', []))
            self._results_cache = DictSearchResults(
                self.type, response, results, None)
        return self._results_cache
563335
def search(self, text):
        
        key = hash(text)
        searcher = self._searchers.get(key)
        if not searcher:
            searcher = ReverseFileSearcher(self.filename, text)
            self._searchers[key] = searcher

        position = searcher.find()
        if position < 0:
            # reset the searcher to start from the tail again.
            searcher.reset()
            return -1, -1, ''

        # try to get some content from before and after the result's position
        read_before = self.buffer_size / 2
        offset = max(position - read_before, 0)
        bufferpos = position if offset == 0 else read_before
        self.fp.seek(offset)
        return position, bufferpos, self.read()
501702
def hashprefs(self):
        
        if 'PreferredHashAlgorithms' in self._signature.subpackets:
            return next(iter(self._signature.subpackets['h_PreferredHashAlgorithms'])).flags
        return []
105130
def search(self, text, lookup=None):
        ''''''
        return self.query().search(text, lookup=lookup)
1116713
def _search(self, words, include=None, exclude=None, lookup=None):
        ''''''
        lookup = lookup or 'contains'
        query = self.router.worditem.query()
        if include:
            query = query.filter(model_type__in=include)
        if exclude:
            query = query.exclude(model_type__in=include)
        if not words:
            return [query]
        qs = []
        if lookup == 'in':
            # we are looking for items with at least one word in it
            qs.append(query.filter(word__in=words))
        elif lookup == 'contains':
            #we want to match every single words
            for word in words:
                qs.append(query.filter(word=word))
        else:
            raise ValueError('Unknown lookup "{0}"'.format(lookup))
        return qs
321643
def _instant_search(self):
        
        _keys = []
        for k,v in self.searchables.iteritems():
            if self.string in v:
                _keys.append(k)
        self.candidates.append(_keys)
1353531
def search_ip(self, searchterm):
        
        return self.__search(type_attribute=self.__mispiptypes(), value=searchterm)
43857
def _search(self, trie, strings, limit=None):
        
        results = [trie.has_keys_with_prefix(s) for s in strings]
        if not any(results):
            return []
        for result, s in zip(results, strings):
            if result is True:
                return trie.values(s)[:limit]
965617
def build_search(self):
        
        s = self.search()
        s = self.query(s, self._query)
        s = self.filter(s)
        if self.fields:
            s = self.highlight(s)
        s = self.sort(s)
        self.aggregate(s)
        return s
522448
def map_search_params(search_params)
      Hash[search_params.map {|k, v| [key_map[k], v] }]
    end
829315
def filter(self, search):
        
        if not self._filters:
            return search

        post_filter = MatchAll()
        for f in itervalues(self._filters):
            post_filter &= f
        return search.post_filter(post_filter)
255814
def search(type)
      resource_class = parse_type(type)
      client_setup
      filter = parse_hash(options['filter'])
      matches = resource_class.find_by(@client, filter)
      if matches.empty? # Search with integers & booleans converted
        filter = parse_hash(options['filter'], true)
        matches = resource_class.find_by(@client, filter) unless filter == options['filter']
      end
      if options['attribute']
        data = select_attributes_from_multiple(options['attribute'], matches)
        output data, -2 # Shift left by 2 so things look right
      else # List names only by default
        names = []
        matches.each { |m| names.push(m['name']) }
        output names
      end
    end