-@when(u'searching for "(?P<query>.*)"(?P<dups> with dups)?')
-def query_cmd(context, query, dups):
- """ Query directly via PHP script.
- """
- cmd = ['/usr/bin/env', 'php']
- cmd.append(os.path.join(context.nominatim.build_dir, 'utils', 'query.php'))
- if query:
- cmd.extend(['--search', query])
- # add more parameters in table form
- if context.table:
- for h in context.table.headings:
- value = context.table[0][h].strip()
- if value:
- cmd.extend(('--' + h, value))
-
- if dups:
- cmd.extend(('--dedupe', '0'))
-
- outp, err = run_script(cmd, cwd=context.nominatim.build_dir)
-
- context.response = SearchResponse(outp, 'json')
-