本文整理汇总了Python中searcher.Searcher.getHits方法的典型用法代码示例。如果您正苦于以下问题:Python Searcher.getHits方法的具体用法?Python Searcher.getHits怎么用?Python Searcher.getHits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类searcher.Searcher
的用法示例。
在下文中一共展示了Searcher.getHits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from searcher import Searcher [as 别名]
# 或者: from searcher.Searcher import getHits [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()))