当前位置: 首页>>代码示例>>Python>>正文


Python Searcher.getHighlighting方法代码示例

本文整理汇总了Python中searcher.Searcher.getHighlighting方法的典型用法代码示例。如果您正苦于以下问题:Python Searcher.getHighlighting方法的具体用法?Python Searcher.getHighlighting怎么用?Python Searcher.getHighlighting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在searcher.Searcher的用法示例。


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

示例1: MainWindow

# 需要导入模块: from searcher import Searcher [as 别名]
# 或者: from searcher.Searcher import getHighlighting [as 别名]
class MainWindow(QtGui.QMainWindow, Ui_MainWindow):

    def __init__(self, parent = None):
        super(MainWindow, self).__init__(parent)

        self.setupUi(self)

        self.searchResultsView = SearchResultsView(self.listView_result)
        self.searchResultsView.viewDetailedContent.connect(self.showDetailedContent)

        self.facetView = FacetView(self.treeView_facet)
        self.facetView.facetOptionChanged.connect(self.search)

        # searcher
        self.searcher = Searcher()
        self.searcher.searchDone.connect(self.searchDone)

        self.createConnections()

    def createConnections(self):
        self.pushButton_search.clicked.connect(self.searchResultsView.clear)
        self.pushButton_search.clicked.connect(self.facetView.clear)
        self.pushButton_search.clicked.connect(self.search)

    def search(self):
        query = self.lineEdit_search.text()
        options = self.facetView.getFacetSearchOptions()
        self.searcher.search(query, options)

    def showDetailedContent(self, fileLocation):
        myviewer = viewer.viewerSimpleFactory(fileLocation, self)
        myviewer.showDetailedContent()

    @QtCore.Slot(int)
    def searchDone(self, searchResultCount):
        if searchResultCount > 0:
            self.searchResultsView.handleSearchResults(self.searcher.getDocs(), self.searcher.getHighlighting())
            self.facetView.handleSearchResults(self.searcher.getFacets())

        self.label_searchResult.setText('About {0} search results for [{1}]'.format(searchResultCount, self.searcher.getQuery()))
开发者ID:zhongzhu,项目名称:searchmyworkspace,代码行数:42,代码来源:mainwindow.py


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