Пример #1
0
	def test_search_mobile(self):
		search_words = u'نكح'
		page_number = 1
		option = "or"
		result_string = search.search_mobile(search_words, page_number, option, index_path)
		result_obj = json.loads(result_string)
		# print result_obj
		self.assertEqual(18, result_obj['count'])
		self.assertEqual(10, len(result_obj['result']))
		page_number = 2
		result_string2 = search.search_mobile(search_words, page_number, option, index_path)
		# print "\n\n", result_string2
		result_obj = json.loads(result_string2)
		self.assertEqual(18, result_obj['count'])
		self.assertEqual(8, len(result_obj['result']))
Пример #2
0
	def test_search_prefix_and(self):
		search_words = u'سجد'
		option = 'and-fix'
		page_number = 1
		result_string = search.search_mobile(search_words, page_number, option, index_path)
		result_obj = json.loads(result_string)
		# print result_obj
		self.assertEqual(111, result_obj['count'])
Пример #3
0
	def test_search_or(self):
		search_words = u'حقيقة العيوب في النكاح وأثرها في فسخ النكاح'
		page_number = 1
		option = "or"
		result_string = search.search_mobile(search_words, page_number, option, index_path)
		result_obj = json.loads(result_string)
		# print 'total hits=', len(result_obj['result'])
		# print result_obj
		self.assertEqual(3651, int(result_obj['count']))
Пример #4
0
def get_search(request):
	return HttpResponse(search.search_mobile(query(request, "word"), query(request, "page"),
											query(request, "option"), settings.WHOOSH_INDEX_PATH))