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


Python Searcher.getFacets方法代码示例

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


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

示例1: MainWindow

# 需要导入模块: from searcher import Searcher [as 别名]
# 或者: from searcher.Searcher import getFacets [as 别名]
class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
       
    def __init__(self, parent = None):
        super(MainWindow, self).__init__(parent)
                
        self.setupUi(self)

        self.setWindowTitle("Search My Workspace")

        # List to display search results
        self.searchResultsModel = SearchResultsModel()
        self.listView_result.setModel(self.searchResultsModel)

        searchResultsDelegate = SearchResultsDelegate(self.listView_result)
        self.listView_result.setItemDelegate(searchResultsDelegate);

        # Tree to display facets
        self.facetModel = FacetModel()
        self.treeView_facet.setModel(self.facetModel)
        self.facetModel.modelReset.connect(self.treeView_facet.expandAll)

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

        # signal slots
        self.createConnections()                

    ''' connect signal/slot pairs '''
    def createConnections(self):
        self.pushButton_search.clicked.connect(self.searchResultsModel.clearMyModel)
        self.pushButton_search.clicked.connect(self.facetModel.clearMyModel)
        self.pushButton_search.clicked.connect(self.search)

    def search(self):
        query = self.lineEdit_search.text()
        self.searcher.search(query)

    def searchDone(self):
        self.searchResultsModel.handleSearchResults(self.searcher.getDocs())
        self.facetModel.handleSearchResults(self.searcher.getFacets())
        self.label_searchResult.setText('About {0} search results for [{1}]'.format(self.searcher.getHits(), self.searcher.getQuery()))
开发者ID:zhongzhu,项目名称:exercise,代码行数:44,代码来源:mainwindow.py

示例2: MainWindow

# 需要导入模块: from searcher import Searcher [as 别名]
# 或者: from searcher.Searcher import getFacets [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.getFacets方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。