本文整理匯總了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):