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


Python SearchEngineFactory.create_index方法代码示例

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


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

示例1: prepare_resource_relations_index

# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
def prepare_resource_relations_index(create=False):
    """
    Creates the settings and mappings in Elasticsearch to support related resources

    """

    index_settings = {
        'mappings': {
            'all': {
                'properties': {
                    'resourcexid': {'type': 'keyword'},
                    'notes': {'type': 'text'},
                    'relationshiptype': {'type': 'keyword'},
                    'resourceinstanceidfrom': {'type': 'keyword'},
                    'resourceinstanceidto': {'type': 'keyword'},
                    'created': {'type': 'keyword'},
                    'modified': {'type': 'keyword'}
                }
            }
        }
    }

    if create:
        se = SearchEngineFactory().create()
        se.create_index(index='resource_relations', body=index_settings, ignore=400)

    return index_settings
开发者ID:fargeo,项目名称:arches,代码行数:29,代码来源:mappings.py

示例2: prepare_resource_relations_index

# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
    def prepare_resource_relations_index(self, create=False):
        """
        Creates the settings and mappings in Elasticsearch to support related resources

        """

        index_settings = { 
            'mappings':{
                'all': {
                    'properties': {
                        'resourcexid': {'type': 'long'},
                        'notes': { 'type': 'string'},
                        'relationshiptype': {'type': 'string', 'index' : 'not_analyzed'},
                        'entityid2': {'type': 'string', 'index' : 'not_analyzed'},
                        'entityid1': {'type': 'string', 'index' : 'not_analyzed'}
                    }  
                }
            }
        }    

        if create:
            se = SearchEngineFactory().create()
            se.create_index(index='resource_relations', body=index_settings, ignore=400)

        return index_settings
开发者ID:oswalpalash,项目名称:arches,代码行数:27,代码来源:resource.py

示例3: prepare_search_index

# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
    def prepare_search_index(self, resource_type_id, create=False):
        """
        Creates the settings and mappings in Elasticsearch to support resource search

        """

        index_settings = super(Resource, self).prepare_search_index(resource_type_id, create=False)

        index_settings['mappings'][resource_type_id]['properties']['date_groups'] = { 
            'properties' : {
                'conceptid': {'type' : 'string', 'index' : 'not_analyzed'}
            }
        }
        
        #index_settings['mappings'][resource_type_id]['properties']['measurement_groups'] = { 
        #    'properties' : {
        #        'conceptid': {'type' : 'string', 'index' : 'not_analyzed'}
        #    }
        #}

        if create:
            se = SearchEngineFactory().create()
            try:
                se.create_index(index='entity', body=index_settings)
            except:
                index_settings = index_settings['mappings']
                se.create_mapping(index='entity', doc_type=resource_type_id, body=index_settings)
开发者ID:bojankastelic,项目名称:zbiva,代码行数:29,代码来源:resource_delujoc.py

示例4: setUpClass

# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
 def setUpClass(cls):
     se = SearchEngineFactory().create()
     se.delete_index(index="concept_labels")
     se.delete_index(index="term")
     se.create_index(index="concept_labels")
     se.create_index(index="term")
     management.call_command(
         "packages", operation="import_json", source="tests/fixtures/resource_graphs/archesv4_resource.json"
     )
开发者ID:archesproject,项目名称:arches,代码行数:11,代码来源:concept_import_tests.py

示例5: prepare_term_index

# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
    def prepare_term_index(self, create=False):
        """
        Creates the settings and mappings in Elasticsearch to support term search

        """

        index_settings = {
            'settings':{
                'analysis': {
                    'analyzer': {
                        'folding': {
                            'tokenizer': 'standard',
                            'filter':  [ 'lowercase', 'asciifolding' ]
                        }
                    }
                }
            },
            'mappings':{
                'value':{
                    'properties': {
                        'ids':{'type': 'string', 'index' : 'not_analyzed'},
                        'context':{'type': 'string', 'index' : 'not_analyzed'},
                        'term': { 
                            'type': 'string',
                            'analyzer': 'standard',
                            'fields': {
                                'folded': { 
                                    'type': 'string',
                                    'analyzer': 'folding'
                                }
                            }
                        }
                    }            
                }            
            }
        }

        if create:
            se = SearchEngineFactory().create()
            se.create_index(index='term', body=index_settings, ignore=400)

        return index_settings
开发者ID:oswalpalash,项目名称:arches,代码行数:44,代码来源:resource.py

示例6: prepare_search_index

# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]

#.........这里部分代码省略.........
                            'filter':  [ 'lowercase', 'asciifolding' ]
                        }
                    }
                }
            },
            'mappings': {
                resource_type_id : {
                    'properties' : {
                        'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'property' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'value' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'label' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'primaryname': {'type' : 'string', 'index' : 'not_analyzed'},
                        'child_entities' : { 
                            'type' : 'nested', 
                            'index' : 'analyzed',
                            'properties' : {
                                'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'property' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'label' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'value' : {
                                    'type' : 'string',
                                    'index' : 'analyzed',
                                    'fields' : {
                                        'raw' : { 'type' : 'string', 'index' : 'not_analyzed'},
                                        'folded': { 'type': 'string', 'analyzer': 'folding'}
                                    }
                                }
                            }
                        },
                        'domains' : { 
                            'type' : 'nested', 
                            'index' : 'analyzed',
                            'properties' : {
                                'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'property' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'label' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'value' : {
                                    'type' : 'string',
                                    'index' : 'analyzed',
                                    'fields' : {
                                        'raw' : { 'type' : 'string', 'index' : 'not_analyzed'}
                                    }
                                },
                                'conceptid' : {'type' : 'string', 'index' : 'not_analyzed'},
                            }
                        },
                        'geometries' : { 
                            'type' : 'nested', 
                            'index' : 'analyzed',
                            'properties' : {
                                'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'property' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'label' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'value' : {
                                    "type": "geo_shape"
                                }
                            }
                        },
                        'dates' : { 
                            'type' : 'nested', 
                            'index' : 'analyzed',
                            'properties' : {
                                'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'property' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'label' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'value' : {
                                    "type" : "date"
                                }
                            }
                        }
                    }
                }
            }
        }

        if create:
            se = SearchEngineFactory().create()
            try:
                se.create_index(index='entity', body=index_settings)
            except:
                index_settings = index_settings['mappings']
                se.create_mapping(index='entity', doc_type=resource_type_id, body=index_settings)

        return index_settings
开发者ID:oswalpalash,项目名称:arches,代码行数:104,代码来源:resource.py

示例7: tearDownClass

# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
	def tearDownClass(cls):
		se = SearchEngineFactory().create()
		se.delete_index(index='strings')
		se.create_index(index='strings')
开发者ID:azerbini,项目名称:eamena,代码行数:6,代码来源:concept_import_tests.py

示例8: prepare_search_index

# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]

#.........这里部分代码省略.........
                    'strings' : {
                        'type' : 'nested',
                        'properties': {
                            'string': {
                                'type' : 'text',
                                'index' : 'analyzed',
                                'fields' : {
                                    'raw' : {'type': 'keyword'},
                                    'folded': { 'type': 'text', 'analyzer': 'folding'}
                                }
                            },
                            'nodegroup_id' : {'type': 'keyword'},
                            'provisional': {'type': 'keyword'}
                        }
                    },
                    'domains' : {
                        'type' : 'nested',
                        'properties' : {
                            'value' : {
                                'type' : 'text',
                                'index' : 'analyzed',
                                'fields' : {
                                    'raw' : {'type': 'keyword'}
                                }
                            },
                            'conceptid' : {'type': 'keyword'},
                            'valueid' : {'type': 'keyword'},
                            'nodegroup_id' : {'type': 'keyword'},
                            'provisional': {'type': 'keyword'}
                        }
                    },
                    'geometries' : {
                        'type' : 'nested',
                        'properties': {
                            'geom': {
                                'properties': {
                                    'features': {
                                        'properties': {
                                            'geometry': {'type': 'geo_shape'},
                                            'id': {'type': 'keyword'},
                                            'type': {'type': 'keyword'},
                                            'properties': {
                                                 'enabled': False
                                            }
                                        }
                                    },
                                    'type': {'type': 'keyword'}
                                }
                            },
                            'nodegroup_id' : {'type': 'keyword'},
                            'provisional': {'type': 'keyword'}
                        }
                    },
                    'points': {
                        'type' : 'nested',
                        'properties' : {
                            'point' : {'type': 'geo_point'},
                            'nodegroup_id' : {'type': 'keyword'},
                            'provisional': {'type': 'keyword'}
                        }
                    },
                    'dates' : {
                        'type' : 'nested',
                        'properties' : {
                            'date' : {'type': 'float'},
                            'nodegroup_id' : {'type': 'keyword'},
                            'nodeid' : {'type': 'keyword'},
                            'provisional': {'type': 'keyword'}
                        }
                    },
                    'numbers' : {
                        'type' : 'nested',
                        'properties' : {
                            'number' : {'type': 'double'},
                            'nodegroup_id' : {'type': 'keyword'},
                            'provisional': {'type': 'keyword'}
                        }
                    },
                    'date_ranges': {
                        'type' : 'nested',
                        'properties' : {
                            'date_range' : {'type': 'float_range'},
                            'nodegroup_id' : {'type': 'keyword'},
                            'provisional': {'type': 'keyword'}
                        }
                    }
                }
            }
        }
    }

    if create:
        se = SearchEngineFactory().create()
        try:
            se.create_index(index='resource', body=index_settings)
        except:
            index_settings = index_settings['mappings']
            se.create_mapping(index='resource', doc_type=resource_model_id, body=index_settings)

    return index_settings
开发者ID:fargeo,项目名称:arches,代码行数:104,代码来源:mappings.py

示例9: prepare_term_index

# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
def prepare_term_index(create=False):
    """
    Creates the settings and mappings in Elasticsearch to support term search

    """

    index_settings = {
        'settings': {
            'analysis': {
                'analyzer': {
                    'folding': {
                        'tokenizer': 'standard',
                        'filter': [ 'lowercase', 'asciifolding' ]
                    }
                }
            }
        },
        'mappings': {
            'term': {
                'properties': {
                    'nodegroupid': {'type': 'keyword'},
                    'tileid': {'type': 'keyword'},
                    'nodeid': {'type': 'keyword'},
                    'resourceinstanceid': {'type': 'keyword'},
                    'provisional': {'type': 'keyword'},
                    'value': {
                        'analyzer': 'standard',
                        'type': 'text',
                        'fields': {
                            'raw': {'type': 'keyword'},
                            'folded': {
                                'analyzer': 'folding',
                                'type': 'text'
                            }
                        }
                    }
                }
            },
            'concept': {
                'properties': {
                    'top_concept': {'type': 'keyword'},
                    'conceptid': {'type': 'keyword'},
                    'language': {'type': 'keyword'},
                    'id': {'type': 'keyword'},
                    'category': {'type': 'keyword'},
                    'provisional': {'type': 'keyword'},
                    'type': {'type': 'keyword'},
                    'value': {
                        'analyzer': 'standard',
                        'type': 'text',
                        'fields': {
                            'raw': {'type': 'keyword'},
                            'folded': {
                                'analyzer': 'folding',
                                'type': 'text'
                            }
                        }
                    }
                }
            }
        }
    }

    if create:
        se = SearchEngineFactory().create()
        se.create_index(index='strings', body=index_settings)

    return index_settings
开发者ID:fargeo,项目名称:arches,代码行数:70,代码来源:mappings.py

示例10: tearDownClass

# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]
 def tearDownClass(cls):
     se = SearchEngineFactory().create()
     se.delete_index(index="concept_labels")
     se.delete_index(index="term")
     se.create_index(index="concept_labels")
     se.create_index(index="term")
开发者ID:archesproject,项目名称:arches,代码行数:8,代码来源:concept_import_tests.py

示例11: base_prepare_search_index

# 需要导入模块: from arches.app.search.search_engine_factory import SearchEngineFactory [as 别名]
# 或者: from arches.app.search.search_engine_factory.SearchEngineFactory import create_index [as 别名]

#.........这里部分代码省略.........
                        }
                    }
                }
            },
            'mappings': {
                resource_type_id : {
                    'properties' : {
                        'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'property' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'value' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'label' : {'type' : 'string', 'index' : 'not_analyzed'},
                        'primaryname': {'type' : 'string', 'index' : 'not_analyzed'},
                        'child_entities' : { 
                            'type' : 'nested', 
                            'index' : 'analyzed',
                            'properties' : {
                                'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'property' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'label' : {'type' : 'string', 'analyzer': 'ducet_sort'},
                                'value' : {
                                    'type' : 'string',
                                    "index_analyzer": "index_ngram",
                                    "search_analyzer": "search_ngram",
                                    'fields' : {
                                        'raw' : { 'type' : 'string', 'index' : 'not_analyzed'},
                                        'folded': { 'type': 'string', 'analyzer': 'folding'}
                                    }
                                }
                            }
                        },
                        'domains' : { 
                            'type' : 'nested', 
                            'index' : 'analyzed',
                            'properties' : {
                                'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'property' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'label' : {'type' : 'string', 'analyzer': 'ducet_sort'},
                                'value' : {
                                    'type' : 'string',
                                    'index' : 'analyzed',
                                    'fields' : {
                                        'raw' : { 'type' : 'string', 'index' : 'not_analyzed'}
                                    }
                                },
                                'conceptid' : {'type' : 'string', 'index' : 'not_analyzed'},
                            }
                        },
                        'geometries' : { 
                            'type' : 'nested', 
                            'index' : 'analyzed',
                            'properties' : {
                                'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'property' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'label' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'value' : {
                                    "type": "geo_shape"
                                }
                            }
                        },
                        'dates' : { 
                            'type' : 'nested', 
                            'index' : 'analyzed',
                            'properties' : {
                                'entityid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'parentid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'property' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'entitytypeid' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'businesstablename' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'label' : {'type' : 'string', 'index' : 'not_analyzed'},
                                'value' : {
                                    "type" : "date"
                                }
                            }
                        }
                    }
                }
            }
        }
        
        if create:
            se = SearchEngineFactory().create()
            try:
                se.create_index(index='entity', body=index_settings)
            except:
                index_settings = index_settings['mappings']
                se.create_mapping(index='entity', doc_type=resource_type_id, body=index_settings)

        return index_settings
开发者ID:bojankastelic,项目名称:zbiva,代码行数:104,代码来源:resource.py


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