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


Python search.search方法代码示例

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


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

示例1: extend

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def extend(self):
    profile = self.profile
    res = search.search(profile.bestname(),['twitter.com','facebook.com','plus.google.com','linkedin.com'],True)
    for r in res:
      wp = WebProfiler.fromURL(r)
      if wp:
        resultprofile =  wp.getProfile()
        if resolver.areEquivalent(resultprofile,profile):
            #merge the mined fields.
            profile.names = list(set(profile.names+resultprofile.names))
            profile.education = list(set(profile.education+resultprofile.education))
            profile.location_set = list(set(profile.location_set+resultprofile.location_set))
            profile.email_addresses = list(set(profile.email_addresses+resultprofile.email_addresses))
            profile.phone_numbers = list(set(profile.phone_numbers+resultprofile.phone_numbers))
            profile.grouped = list(set(profile.grouped+resultprofile.grouped))
            profile.web_links = list(set(profile.web_links+resultprofile.web_links+[r]))
            profile.profile_links = list(set(profile.profile_links+resultprofile.profile_links))
        self.profile = profile
    return self.profile 
开发者ID:Betawolf,项目名称:social-vuln-scanner,代码行数:21,代码来源:personalProfileMiner.py

示例2: search

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def search(self, query, attributes=['name', 'description'], limit=10):
        return search.search(query, attributes, Item.select(), limit) 
开发者ID:nbschool,项目名称:ecommerce_api,代码行数:4,代码来源:test_searchitem.py

示例3: test_search_tavolo_sedie

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def test_search_tavolo_sedie(self):
        result = self.search('tavolo sedie')

        res = ['tavolo con sedie', 'tavolo con set di sedie', 'tavolo da cucina',
               'tavolino', 'tavola di legno', 'sedie', 'set di sedie', 'tavolo', 'tavola']
        assert res == get_names(result) 
开发者ID:nbschool,项目名称:ecommerce_api,代码行数:8,代码来源:test_searchitem.py

示例4: test_search_tavolo

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def test_search_tavolo(self):
        result = self.search('tavolo')
        res = ['tavolo', 'tavolino', 'tavola', 'tavola di legno', 'legno di tavola',
               'tavolo con sedie', 'tavolo con set di sedie', 'tavolo da cucina', 'poltrona',
               'letto singolo']
        assert res == get_names(result) 
开发者ID:nbschool,项目名称:ecommerce_api,代码行数:8,代码来源:test_searchitem.py

示例5: test_search_sedia

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def test_search_sedia(self):
        result = self.search('sedia')

        res = ['sedie', 'set di sedie', 'sedie da cucina', 'sedie deco',
               'divano', 'tavolo con sedie', 'tavolo con set di sedie', 'divano letto']
        assert res == get_names(result) 
开发者ID:nbschool,项目名称:ecommerce_api,代码行数:8,代码来源:test_searchitem.py

示例6: test_search_sedie

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def test_search_sedie(self):
        result = self.search('sedie')

        res = ['sedie', 'set di sedie', 'sedie deco', 'sedie da cucina',
               'tavolo con sedie', 'tavolo con set di sedie', 'scarpine']
        assert res == get_names(result) 
开发者ID:nbschool,项目名称:ecommerce_api,代码行数:8,代码来源:test_searchitem.py

示例7: test_search_letto

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def test_search_letto(self):
        result = self.search('letto')

        res = ['letto', 'letto matrimoniale', 'divano letto', 'letto singolo', 'letto francese',
               'tavola di legno', 'legno di tavola', 'poltrona elettrica', 'sedie deco', 'tavolo']
        assert res == get_names(result) 
开发者ID:nbschool,项目名称:ecommerce_api,代码行数:8,代码来源:test_searchitem.py

示例8: test_search_scarpette

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def test_search_scarpette(self):
        result = self.search('scarpette')

        res = ['scarpette', 'scarpe', 'scarpine', 'scarpacce', 'scarponi',
               'scarpe da ginnastica', 'scarpe da ballo', 'maglietta', 'canottiera',
               'letto francese']
        assert res == get_names(result) 
开发者ID:nbschool,项目名称:ecommerce_api,代码行数:9,代码来源:test_searchitem.py

示例9: test_search_scarponi

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def test_search_scarponi(self):
        result = self.search('scarponi')

        res = ['scarponi', 'scarpine', 'scarpe', 'scarpette',
               'scarpacce', 'scarpe da ballo', 'scarpe da ginnastica']
        assert res == get_names(result) 
开发者ID:nbschool,项目名称:ecommerce_api,代码行数:8,代码来源:test_searchitem.py

示例10: test_search_divano

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def test_search_divano(self):
        result = self.search('divano')

        res = ['divano', 'divano letto']
        assert res == get_names(result) 
开发者ID:nbschool,项目名称:ecommerce_api,代码行数:7,代码来源:test_searchitem.py

示例11: search2

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def search2(request):
    params = json.loads(request.body)
    return search.search(params)


# Get distinct values in schema 
开发者ID:scanner-research,项目名称:esper,代码行数:8,代码来源:views.py

示例12: fromPerson

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def fromPerson(person):
    approved = None
    for profile in person.profiles:
      res = search.search(profile.bestname(),['twitter.com','facebook.com','plus.google.com','linkedin.com'],True)
      for r in res:
        wp = WebProfiler.fromURL(r)
        if wp:
            resultprofile = wp.getProfile()
            if resultprofile and resolver.areEquivalent(resultprofile,profile):
              approved = resultprofile
              break
    return approved 
开发者ID:Betawolf,项目名称:social-vuln-scanner,代码行数:14,代码来源:personalProfileMiner.py

示例13: main

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def main(c,t='????',p=2):
	sh 	=search(c)
	lt 	=sh.search(t,p)
	setWeiboMongo(lt)
	rst=getOneWeibo()
	if rst is False:
		print('No more weibo to retweet!')
		return False
	rt=retweet(c)
	state=rt.retweet(rst['mid'],rst['reason'])
	if state:
		return rst
	return False 
开发者ID:chengshuyi,项目名称:SinaWeibo,代码行数:15,代码来源:main.py

示例14: search

# 需要导入模块: import search [as 别名]
# 或者: from search import search [as 别名]
def search(cls, query, dataset, limit=-1,
               attributes=None, weights=None,
               threshold=search.config.THRESHOLD):
        """
        Search a list of resources with the callee class.

        Arguments:
            query (str): Query to lookup for
            dataset (iterable): sequence of resource objects to lookup into
            limit (int): maximum number of resources to return (default -1, all)
            attributes (list): model attribute names. Can be set as default
                inside the model definition or specified on the fly while
                searching.
            weights (list): attributes weights values,indexes should
                match the attribute position in the `attributes` argument.
                if length does not match it will be ignored.
            threshold (float): value between 0 and 1, identify the matching
                threshold for a result to be included.

        Returns:
            list: list of resources that may match the query.

        Raises:
            SearchAttributeMismatch:
                if ``attributes`` are missing, either as model
                default in ``<Model>._search_attributes`` or as param
                one of the object does not have one of the given attribute(s).

        Examples:

            .. code-block:: python

                results = Item.search('shoes', Item.select(), limit=20)
        """

        attributes = attributes or cls._search_attributes
        weights = weights or cls._search_weights

        if not attributes:
            raise SearchAttributeMismatch(
                'Attributes to look for not defined for {}. \
                Please update the Model or specify during search call.\
                '.format(cls.__name__))

        return search.search(query, attributes, dataset, limit, threshold, weights) 
开发者ID:nbschool,项目名称:ecommerce_api,代码行数:47,代码来源:models.py


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