• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python api.perform_search函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中search.api.perform_search函数的典型用法代码示例。如果您正苦于以下问题:Python perform_search函数的具体用法?Python perform_search怎么用?Python perform_search使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了perform_search函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_indexing_responses

    def test_indexing_responses(self):
        """
        Test add_to_search_index response with real data
        """
        # Check results not indexed
        response = perform_search(
            "unique",
            user=self.user,
            size=10,
            from_=0,
            course_id=unicode(self.course.id))
        self.assertEqual(response['results'], [])

        # Start manual reindex
        errors = CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id)
        self.assertEqual(errors, None)

        self.html.display_name = "My expanded HTML"
        modulestore().update_item(self.html, ModuleStoreEnum.UserID.test)

        # Start manual reindex
        errors = CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id)
        self.assertEqual(errors, None)

        # Check results indexed now
        response = perform_search(
            "unique",
            user=self.user,
            size=10,
            from_=0,
            course_id=unicode(self.course.id))
        self.assertEqual(response['total'], 1)
开发者ID:akbargumbira,项目名称:Labster.EdX,代码行数:32,代码来源:test_course_index.py


示例2: test_reindex_json_responses

    def test_reindex_json_responses(self):
        """
        Test json response with real data
        """
        # Check results not indexed
        response = perform_search(
            "unique",
            user=self.user,
            size=10,
            from_=0,
            course_id=unicode(self.course.id))
        self.assertEqual(response['results'], [])

        # Start manual reindex
        reindex_course_and_check_access(self.course.id, self.user)

        self.html.display_name = "My expanded HTML"
        modulestore().update_item(self.html, ModuleStoreEnum.UserID.test)

        # Start manual reindex
        reindex_course_and_check_access(self.course.id, self.user)

        # Check results indexed now
        response = perform_search(
            "unique",
            user=self.user,
            size=10,
            from_=0,
            course_id=unicode(self.course.id))
        self.assertEqual(response['total'], 1)
开发者ID:akbargumbira,项目名称:Labster.EdX,代码行数:30,代码来源:test_course_index.py


示例3: test_indexing_responses

    def test_indexing_responses(self):
        """
        Test do_course_reindex response with real data
        """
        # results are indexed because they are published from ItemFactory
        response = perform_search(
            "unique",
            user=self.user,
            size=10,
            from_=0,
            course_id=unicode(self.course.id))
        self.assertEqual(response['total'], 1)

        # Start manual reindex
        CoursewareSearchIndexer.do_course_reindex(modulestore(),
                                                  self.course.id)

        # Check results are the same following reindex
        response = perform_search(
            "unique",
            user=self.user,
            size=10,
            from_=0,
            course_id=unicode(self.course.id))
        self.assertEqual(response['total'], 1)
开发者ID:moonshot,项目名称:edx-platform,代码行数:25,代码来源:test_course_index.py


示例4: test_reindex_json_responses

    def test_reindex_json_responses(self):
        """
        Test json response with real data
        """
        # results are indexed because they are published from ItemFactory
        response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id))
        self.assertEqual(response["total"], 1)

        # Start manual reindex
        reindex_course_and_check_access(self.course.id, self.user)

        # Check results remain the same
        response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id))
        self.assertEqual(response["total"], 1)
开发者ID:fjardon,项目名称:edx-platform,代码行数:14,代码来源:test_course_index.py


示例5: test_indexing_seq_error_responses

    def test_indexing_seq_error_responses(self, mock_index_dictionary):
        """
        Test do_course_reindex response with mocked error data for sequence
        """
        # results are indexed because they are published from ItemFactory
        response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id))
        self.assertEqual(response["total"], 1)

        # set mocked exception response
        err = Exception
        mock_index_dictionary.return_value = err

        # Start manual reindex and check error in response
        with self.assertRaises(SearchIndexingError):
            CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id)
开发者ID:fjardon,项目名称:edx-platform,代码行数:15,代码来源:test_course_index.py


示例6: test_reindex_html_error_json_responses

    def test_reindex_html_error_json_responses(self, mock_index_dictionary):
        """
        Test json response with mocked error data for html
        """
        # results are indexed because they are published from ItemFactory
        response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id))
        self.assertEqual(response["total"], 1)

        # set mocked exception response
        err = SearchIndexingError
        mock_index_dictionary.return_value = err

        # Start manual reindex and check error in response
        with self.assertRaises(SearchIndexingError):
            reindex_course_and_check_access(self.course.id, self.user)
开发者ID:fjardon,项目名称:edx-platform,代码行数:15,代码来源:test_course_index.py


示例7: test_indexing_seq_error_responses

    def test_indexing_seq_error_responses(self, mock_index_dictionary):
        """
        Test add_to_search_index response with mocked error data for sequence
        """
        # Check results not indexed
        response = perform_search(
            "unique",
            user=self.user,
            size=10,
            from_=0,
            course_id=unicode(self.course.id))
        self.assertEqual(response['results'], [])

        # set mocked exception response
        err = Exception
        mock_index_dictionary.return_value = err

        # Start manual reindex and check error in response
        with self.assertRaises(SearchIndexingError):
            CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id)
开发者ID:akbargumbira,项目名称:Labster.EdX,代码行数:20,代码来源:test_course_index.py


示例8: test_reindex_seq_error_json_responses

    def test_reindex_seq_error_json_responses(self, mock_index_dictionary):
        """
        Test json response with rmocked error data for sequence
        """
        # Check results not indexed
        response = perform_search(
            "unique",
            user=self.user,
            size=10,
            from_=0,
            course_id=unicode(self.course.id))
        self.assertEqual(response['results'], [])

        # set mocked exception response
        err = Exception
        mock_index_dictionary.return_value = err

        # Start manual reindex and check error in response
        with self.assertRaises(SearchIndexingError):
            reindex_course_and_check_access(self.course.id, self.user)
开发者ID:akbargumbira,项目名称:Labster.EdX,代码行数:20,代码来源:test_course_index.py


示例9: test_perform_search

 def test_perform_search(self):
     """ search opertaion should yeild an exception with no search engine """
     with self.assertRaises(NoSearchEngineError):
         perform_search("abc test")
开发者ID:hiepkhachbk,项目名称:edx-search,代码行数:4,代码来源:test_engines.py



注:本文中的search.api.perform_search函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python client.Client类代码示例发布时间:2022-05-27
下一篇:
Python search.Search类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap