blob: fe0a4e174ea1175cc0d9a1420cc703c7a31fa833 [file] [log] [blame]
import logging
import urllib.request, urllib.parse, urllib.error
from edge.writer.proxywriter import ProxyWriter
class Writer(ProxyWriter):
def __init__(self, configFilePath):
super(Writer, self).__init__(configFilePath)
def _generateUrl(self, requestHandler):
url = self._configuration.get('solr', 'url')
parameters = {}
parameters['wt'] = 'json'
parameters['suggest'] = 'true'
#parameters['suggest.build'] = 'true'
try:
parameters['suggest.q'] = requestHandler.get_argument('keyword')
url += '/suggest?' + urllib.parse.urlencode(parameters)
except:
raise Exception('Missing keyword parameter.')
logging.debug("proxy to url : " + url)
return url