+def quote_query_line(argv):
+ #mangle arguments wrapping terms with spaces in quotes
+ for i in xrange(0,len(argv)):
+ if argv[i].find(' ') >= 0:
+ #if we use prefix:termWithSpaces, put quotes around term
+ m = PREFIX.match(argv[i])
+ if m:
+ argv[i] = '%s:"%s"' % (m.group(1), m.group(2))
+ else:
+ argv[i] = '"'+argv[i]+'"'
+ return ' '.join(argv)
+