mirror of https://github.com/searxng/searxng.git
[fix] resolve query_parts regression
This commit is contained in:
parent
0a44fa8bb7
commit
2aef38c3b9
|
@ -59,8 +59,6 @@ class RawTextQuery:
|
|||
# part does only contain spaces, skip
|
||||
if query_part.isspace()\
|
||||
or query_part == '':
|
||||
searx_query_part = True
|
||||
self.query_parts.append(query_part)
|
||||
continue
|
||||
|
||||
# this force the timeout
|
||||
|
@ -147,8 +145,9 @@ class RawTextQuery:
|
|||
self.specific = True
|
||||
|
||||
# append query part to query_part list
|
||||
if searx_query_part:
|
||||
self.query_parts.append(query_part)
|
||||
if not searx_query_part:
|
||||
else:
|
||||
self.user_query_parts.append(query_part)
|
||||
|
||||
def changeQuery(self, query):
|
||||
|
@ -160,4 +159,4 @@ class RawTextQuery:
|
|||
|
||||
def getFullQuery(self):
|
||||
# get full querry including whitespaces
|
||||
return ''.join(self.query_parts)
|
||||
return '{0} {1}'.format(''.join(self.query_parts), self.getQuery()).strip()
|
||||
|
|
|
@ -9,7 +9,8 @@ class TestQuery(SearxTestCase):
|
|||
query = RawTextQuery(query_text, [])
|
||||
|
||||
self.assertEqual(query.getFullQuery(), query_text)
|
||||
self.assertEqual(len(query.query_parts), 3)
|
||||
self.assertEqual(len(query.query_parts), 0)
|
||||
self.assertEqual(len(query.user_query_parts), 2)
|
||||
self.assertEqual(len(query.languages), 0)
|
||||
self.assertFalse(query.specific)
|
||||
|
||||
|
@ -20,7 +21,7 @@ class TestQuery(SearxTestCase):
|
|||
query = RawTextQuery(full_query, [])
|
||||
|
||||
self.assertEqual(query.getFullQuery(), full_query)
|
||||
self.assertEqual(len(query.query_parts), 5)
|
||||
self.assertEqual(len(query.query_parts), 1)
|
||||
self.assertEqual(len(query.languages), 1)
|
||||
self.assertIn(language, query.languages)
|
||||
self.assertFalse(query.specific)
|
||||
|
@ -32,7 +33,7 @@ class TestQuery(SearxTestCase):
|
|||
query = RawTextQuery(full_query, [])
|
||||
|
||||
self.assertEqual(query.getFullQuery(), full_query)
|
||||
self.assertEqual(len(query.query_parts), 5)
|
||||
self.assertEqual(len(query.query_parts), 1)
|
||||
self.assertIn('en', query.languages)
|
||||
self.assertFalse(query.specific)
|
||||
|
||||
|
@ -43,7 +44,7 @@ class TestQuery(SearxTestCase):
|
|||
query = RawTextQuery(full_query, [])
|
||||
|
||||
self.assertEqual(query.getFullQuery(), full_query)
|
||||
self.assertEqual(len(query.query_parts), 5)
|
||||
self.assertEqual(len(query.query_parts), 1)
|
||||
self.assertIn('all', query.languages)
|
||||
self.assertFalse(query.specific)
|
||||
|
||||
|
@ -54,7 +55,7 @@ class TestQuery(SearxTestCase):
|
|||
query = RawTextQuery(full_query, [])
|
||||
|
||||
self.assertEqual(query.getFullQuery(), full_query)
|
||||
self.assertEqual(len(query.query_parts), 5)
|
||||
self.assertEqual(len(query.query_parts), 0)
|
||||
self.assertEqual(len(query.languages), 0)
|
||||
self.assertFalse(query.specific)
|
||||
|
||||
|
@ -63,7 +64,7 @@ class TestQuery(SearxTestCase):
|
|||
query = RawTextQuery(query_text, [])
|
||||
|
||||
self.assertEqual(query.getFullQuery(), query_text)
|
||||
self.assertEqual(len(query.query_parts), 5)
|
||||
self.assertEqual(len(query.query_parts), 1)
|
||||
self.assertEqual(query.timeout_limit, 3)
|
||||
self.assertFalse(query.specific)
|
||||
|
||||
|
@ -72,7 +73,7 @@ class TestQuery(SearxTestCase):
|
|||
query = RawTextQuery(query_text, [])
|
||||
|
||||
self.assertEqual(query.getFullQuery(), query_text)
|
||||
self.assertEqual(len(query.query_parts), 5)
|
||||
self.assertEqual(len(query.query_parts), 1)
|
||||
self.assertEqual(query.timeout_limit, 0.35)
|
||||
self.assertFalse(query.specific)
|
||||
|
||||
|
@ -81,7 +82,7 @@ class TestQuery(SearxTestCase):
|
|||
query = RawTextQuery(query_text, [])
|
||||
|
||||
self.assertEqual(query.getFullQuery(), query_text)
|
||||
self.assertEqual(len(query.query_parts), 5)
|
||||
self.assertEqual(len(query.query_parts), 1)
|
||||
self.assertEqual(query.timeout_limit, 3.5)
|
||||
self.assertFalse(query.specific)
|
||||
|
||||
|
@ -91,6 +92,7 @@ class TestQuery(SearxTestCase):
|
|||
query = RawTextQuery(query_text, [])
|
||||
|
||||
self.assertEqual(query.getFullQuery(), query_text)
|
||||
self.assertEqual(len(query.query_parts), 5)
|
||||
self.assertEqual(len(query.query_parts), 0)
|
||||
self.assertEqual(query.getQuery(), query_text)
|
||||
self.assertEqual(query.timeout_limit, None)
|
||||
self.assertFalse(query.specific)
|
||||
|
|
Loading…
Reference in New Issue