本文整理汇总了Python中com.googlecode.fascinator.common.solr.SolrResult.getQueryTime方法的典型用法代码示例。如果您正苦于以下问题:Python SolrResult.getQueryTime方法的具体用法?Python SolrResult.getQueryTime怎么用?Python SolrResult.getQueryTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.googlecode.fascinator.common.solr.SolrResult
的用法示例。
在下文中一共展示了SolrResult.getQueryTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __activate__
# 需要导入模块: from com.googlecode.fascinator.common.solr import SolrResult [as 别名]
# 或者: from com.googlecode.fascinator.common.solr.SolrResult import getQueryTime [as 别名]
#.........这里部分代码省略.........
#print " * search.py:", req.toString(), self.__pageNum
out = ByteArrayOutputStream()
self.services.indexer.search(req, out)
self.__result = SolrResult(ByteArrayInputStream(out.toByteArray()))
if self.__result is not None:
self.__paging = Pagination(self.__pageNum,
self.__result.getNumFound(),
self.__portal.recordsPerPage)
def __escapeQuery(self, q):
temp = ""
chars = "+-&|!(){}[]^\"~*?:\\"
for c in q:
if c in chars:
temp += "\%s" % c
else:
temp += c
return temp
# eq = q
# # escape all solr/lucene special chars
# # from http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Escaping%20Special%20Characters
# for c in "+-&|!(){}[]^\"~*?:\\":
# eq = eq.replace(c, "\\%s" % c)
# ## Escape UTF8
# try:
# return URLEncoder.encode(eq, "UTF-8")
# except UnsupportedEncodingException, e:
# print "Error during UTF8 escape! ", repr(eq)
# return eq
def getQueryTime(self):
return int(self.__result.getQueryTime()) / 1000.0;
def getPaging(self):
return self.__paging
def getResult(self):
return self.__result
def getFacetField(self, key):
return self.__portal.facetFields.get(key)
def getFacetName(self, key):
return self.__portal.facetFields.get(key).getString(None, ["label"])
def getFacetCounts(self, key):
if self.__useSessionNavigation:
facetData = self.__result.getFacets()
if facetData is None:
return LinkedHashMap()
if not facetData.containsKey(key):
return LinkedHashMap()
return facetData.get(key).values()
else:
return LinkedHashMap()
# TODO : What were these doing? Hiding file path facets unless some facets are selected?
#if name.find("/") == -1 or self.hasSelectedFacets():
# values.put(name, count)
def getFacetDisplay(self):
return self.__portal.facetDisplay
def hasSelectedFacets(self):