       path: "/#{@version}/search?#{query_string}"
       headers: headers
 
+    if @localhost and @localport
+      options.host = @localhost
+      options.port = @localport
 
     # Callback function will be passed as argument to search
     # and will be returned with response body

  @param {String} api_key
  @api public
  ###
  constructor: (@hashid, api_key, rpp, local) ->
    @version = "4"
    @params =
      query: ""
      rpp: 10
      page: 1
      transformer: "dflayer"
    @filters = {}
    
    if api_key
      [ zone, @api_key ] = api_key.split '-'
      @url = zone + "-search.doofinder.com"

    if rpp
      @params.rpp = rpp

    if local
      @url = "localhost:8881"
  
  ###
  search

  ###
  search: (params, callback) ->
    headers = {}
    @params = {}
    @filters = {}
    for param_key, param_value of params
      if param_key == "filters"
        for filter_key, filter_terms of param_value
