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


Python Solr._from_python方法代码示例

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


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

示例1: DESolrSearchBackend

# 需要导入模块: from seo_pysolr import Solr [as 别名]
# 或者: from seo_pysolr.Solr import _from_python [as 别名]

#.........这里部分代码省略.........
            kwargs['sort'] = sort_by

        if bf is not None:
            kwargs['bf'] = bf

        if start_offset is not None:
            kwargs['start'] = start_offset

        if end_offset is not None:
            kwargs['rows'] = end_offset - start_offset

        if highlight is True:
            kwargs['hl'] = 'true'
            kwargs['hl.fragsize'] = '100'
            kwargs['hl.snippets'] = '2'
            kwargs['hl.mergeContiguous'] = 'true'
            kwargs['hl.simple.pre'] = '<b>'
            kwargs['hl.simple.post'] = '</b>'

        if self.include_spelling is True:
            kwargs['spellcheck'] = 'true'
            kwargs['spellcheck.collate'] = 'true'
            kwargs['spellcheck.count'] = 1

            if spelling_query:
                kwargs['spellcheck.q'] = spelling_query

        if facets is not None:
            kwargs['facet'] = 'on'
            kwargs['facet.field'] = facets.keys()

            for facet_field, options in facets.items():
                for key, value in options.items():
                    kwargs['f.%s.facet.%s' % (facet_field, key)] = self.conn._from_python(value)

        if facet_mincount is not None:
            kwargs['facet'] = 'on'
            kwargs['facet.mincount'] = facet_mincount

        if facet_limit is not None:
            kwargs['facet'] = 'on'
            kwargs['facet.limit'] = facet_limit

        if facet_prefix is not None:
            kwargs['facet'] = 'on'
            kwargs['facet.prefix'] = facet_prefix

        if facet_sort is not None:
            kwargs['facet'] = 'on'
            kwargs['facet.sort'] = facet_sort

        if facet_offset is not None:
            kwargs['facet'] = 'on'
            kwargs['facet.offset'] = facet_offset

        if date_facets is not None:
            kwargs['facet'] = 'on'
            kwargs['facet.date'] = date_facets.keys()
            kwargs['facet.date.other'] = 'none'

            for key, value in date_facets.items():
                kwargs["f.%s.facet.date.start" % key] = self.conn._from_python(value.get('start_date'))
                kwargs["f.%s.facet.date.end" % key] = self.conn._from_python(value.get('end_date'))
                gap_by_string = value.get('gap_by').upper()
                gap_string = "%d%s" % (value.get('gap_amount'), gap_by_string)
开发者ID:AstroMatchDynamics,项目名称:MyJobs,代码行数:69,代码来源:search_backend.py


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