Helper method for query methods that return a two-dimensional hashes in which the keys are not relevant to the
   returning value. In most cases this key is a redundant page or revision ID that is also available in the object.
 @param (see #query_ary)
760782
def query_ary_irrelevant_keys(params, base_response_key, property_key)
      query(params) do |return_val, query|
        return_val.concat(query[base_response_key].values.collect { |obj| obj[property_key] })
      end
    end
35432
def to_query(params)
      unless params.is_a?(Hash)
        raise "Expected Hash but got #{params.class.name}"
      end
      Addressable::URI.form_encode(params)
    end
1056761
def hashify_query_string
      if request.query_string && request.query_string.length > 0
        redirect_to request.url.gsub('?', '#')
        return true
      end
      return false
    end
1342537
def to_a
      hash = {}
      @to_a ||=
        elements_with_tags.map.with_index do |(el, tag_name), idx|
          selector = @selector.dup
          selector[:index] = idx unless idx.zero?
          element = element_class.new(@query_scope, selector)
          if [HTMLElement, Input].include? element.class
            construct_subtype(element, hash, tag_name).tap { |e| e.cache = el }
          else
            element.tap { |e| e.cache = el }
          end
        end
    end
187731
def hash_to_rets_query_string(hash)
      [].tap do |str|
        hash.each_pair do |k,v|
          val = value_map(v)
          str << "(#{k.to_s.camelize}=#{val})"
        end
      end.join(',')
    end
255205
function createUriQueryMapper (query) {
  var parameters = extractQueryParameters(query);
  return (queryValues, args) => {
    queryValues = queryValues || Object.create(null);

    Object.keys(queryValues)
      .forEach(queryKey => {
        var parameter = parameters[queryKey];

        if (!parameter) {
          return;
        }

        var value = util.isArray(queryValues[queryKey]) ?
          queryValues[queryKey]
            .map(parameter.map)
            .filter(value => value !== null) :
          parameter.map(queryValues[queryKey]);

        if (value === null) {
          return;
        }

        args[parameter.name] = value;
      });
  };
}
104160
def query_symbols query
      result = []
      source_map_hash.values.each do |s|
        result.concat s.query_symbols(query)
      end
      result
    end
1169907
def namedb_get_value_hash_txids(cur, value_hash):
    
    query = 'SELECT txid FROM history WHERE value_hash = ? ORDER BY block_id,vtxindex;'
    args = (value_hash,)

    rows = namedb_query_execute(cur, query, args)
    txids = []
    
    for r in rows:
        # present
        txid = str(r['txid'])
        txids.append(txid)

    return txids
101603
INDArray rawBucketOf(INDArray query){
        INDArray pattern = hash(query);

        INDArray res = Nd4j.zeros(DataType.BOOL, index.shape());
        Nd4j.getExecutioner().exec(new BroadcastEqualTo(index, pattern, res, -1));
        return res.castTo(Nd4j.defaultFloatingPointType()).min(-1);
    }
1261303
function Query(state, entity) {
        /**
         * Primary key ids to filter records by. It is used for filtering records
         * direct key lookup when a user is trying to fetch records by its
         * primary key.
         *
         * It should not be used if there is a logic which prevents index usage, for
         * example, an "or" condition which already requires a full scan of records.
         */
        this.idFilter = null;
        /**
         * Whether to use `idFilter` key lookup. True if there is a logic which
         * prevents index usage, for example, an "or" condition which already
         * requires full scan.
         */
        this.cancelIdFilter = false;
        /**
         * Primary key ids to filter joined records. It is used for filtering
         * records direct key lookup. It should not be cancelled, because it
         * is free from the effects of normal where methods.
         */
        this.joinedIdFilter = null;
        /**
         * The where constraints for the query.
         */
        this.wheres = [];
        /**
         * The has constraints for the query.
         */
        this.have = [];
        /**
         * The orders of the query result.
         */
        this.orders = [];
        /**
         * Number of results to skip.
         */
        this.offsetNumber = 0;
        /**
         * Maximum number of records to return.
         *
         * We use polyfill of `Number.MAX_SAFE_INTEGER` for IE11 here.
         */
        this.limitNumber = Math.pow(2, 53) - 1;
        /**
         * The relationships that should be eager loaded with the result.
         */
        this.load = {};
        this.rootState = state;
        this.state = state[entity];
        this.entity = entity;
        this.model = this.getModel(entity);
        this.module = this.getModule(entity);
        this.hook = new Hook(this);
    }
1208711
def load_result
      if array_or_relation.is_a? Array
        result = array_or_relation[offset..(offset + per_page - 1)]
      else
        result = array_or_relation.limit(per_page).offset(offset).all
      end

      self.replace result.nil? ? [] : result
    end
1332659
def hash_vector(self, v, querying=False):
        

        bucket_keys = []

        if querying:
            # If we are querying, use the permuted indexes to get bucket keys
            for child_hash in self.child_hashes:
                lshash = child_hash['hash']
                # Make sure the permuted index for this hash is existing
                if not lshash.hash_name in self.permutation.permutedIndexs:
                    raise AttributeError('Permuted index is not existing for hash with name %s' % lshash.hash_name)

                # Get regular bucket keys from hash
                for bucket_key in lshash.hash_vector(v, querying):
                    #print 'Regular bucket key %s' % bucket_key
                    # Get neighbour keys from permuted index
                    neighbour_keys = self.permutation.get_neighbour_keys(lshash.hash_name,bucket_key)
                    # Add them to result, but prefix with hash name
                    for n in neighbour_keys:
                        bucket_keys.append(lshash.hash_name+'_'+n)

        else:
            # If we are indexing (storing) just use child hashes without permuted index
            for child_hash in self.child_hashes:
                lshash = child_hash['hash']

                # Get regular bucket keys from hash
                for bucket_key in lshash.hash_vector(v, querying):
                    # Register bucket key in child hash dict
                    child_hash['bucket_keys'][bucket_key] = bucket_key
                    # Append bucket key to result prefixed with child hash name
                    bucket_keys.append(lshash.hash_name+'_'+bucket_key)

        # Return all the bucket keys
        return bucket_keys
539094
def namedb_get_names_with_value_hash( cur, value_hash, block_number ):
    

    unexpired_query, unexpired_args = namedb_select_where_unexpired_names( block_number )
    select_query = "SELECT name FROM name_records JOIN namespaces ON name_records.namespace_id = namespaces.namespace_id " + \
                   "WHERE value_hash = ? AND revoked = 0 AND " + unexpired_query + ";"

    args = (value_hash,) + unexpired_args
    name_rows = namedb_query_execute( cur, select_query, args )
    names = []

    for name_row in name_rows:
        names.append( name_row['name'] )

    if len(names) == 0:
        return None
    else:
        return names
1332104
def get_all_file_report_pages(self, query):
        
        responses = []
        r = self.get_hashes_from_search(query)
        responses.append(r)

        if ('results' in r.keys()) and ('next_page' in r['results'].keys()):
            next_page = r['results']['next_page']
        else:
            next_page = None

        while next_page:
            r = self.get_hashes_from_search(query, next_page)

            if ('results' in r.keys()) and ('next_page' in r['results'].keys()):
                next_page = r['results']['next_page']
            else:
                next_page = None

            responses.append(r)
        return dict(results=responses)
1325717
def to_hash(arr)
      arr.map(&:flatten).map { |p| { 'key' => p.first.to_s, 'value' => p.last.to_s } }
    end
1050364
def hash_vector(self, v, querying=False):
        

        bucket_keys = []

        if querying:
            # If we are querying, use the bucket key map
            for lshash in self.child_hashes:
                # Get regular bucket keys from hash
                for bucket_key in lshash.hash_vector(v, querying):
                    prefixed_key = lshash.hash_name+'_'+bucket_key
                    # Get entries from map (bucket keys with hamming distance of 1)
                    if prefixed_key in self.bucket_key_map:
                        bucket_keys.extend(self.bucket_key_map[prefixed_key].keys())
        else:
            # If we are indexing (storing) just use child hashes without permuted index
            for lshash in self.child_hashes:
                # Get regular bucket keys from hash
                for bucket_key in lshash.hash_vector(v, querying):
                    # Get permuted keys
                    perm_keys = self.permuted_keys(bucket_key)
                    # Put extact hit key into list
                    perm_keys.append(bucket_key)

                    # Append key for storage (not the permutations)
                    bucket_keys.append(lshash.hash_name+'_'+bucket_key)

                    # For every permutation register all the variants
                    for perm_key in perm_keys:
                        prefixed_key = lshash.hash_name+'_'+perm_key

                        # Make sure dictionary exists
                        if not prefixed_key in self.bucket_key_map:
                            self.bucket_key_map[prefixed_key] = {}

                        for variant in perm_keys:
                            prefixed_variant = lshash.hash_name+'_'+variant
                            self.bucket_key_map[prefixed_key][prefixed_variant] = 1

        # Return all the bucket keys
        return bucket_keys
522448
def map_search_params(search_params)
      Hash[search_params.map {|k, v| [key_map[k], v] }]
    end