コード例 #1
0
    def index(self):
        """
        Indexes all the nessesary documents related to resources to support the map, search, and reports

        """

        se = SearchEngineFactory().create()

        search_documents = self.prepare_documents_for_search_index()
        for document in search_documents:
            se.index_data('entity',
                          self.entitytypeid,
                          document,
                          id=self.entityid)

            report_documents = self.prepare_documents_for_report_index(
                geom_entities=document['geometries'])
            for report_document in report_documents:
                se.index_data('resource',
                              self.entitytypeid,
                              report_document,
                              id=self.entityid)

            geojson_documents = self.prepare_documents_for_map_index(
                geom_entities=document['geometries'])
            for geojson in geojson_documents:
                se.index_data('maplayers',
                              self.entitytypeid,
                              geojson,
                              idfield='id')

        for term in self.prepare_terms_for_search_index():
            se.index_term(term['term'], term['entityid'], term['context'],
                          term['ewstatus'], term['options'])
コード例 #2
0
ファイル: concept.py プロジェクト: bojankastelic/zbiva
    def index(self, scheme=None):
        if self.category == 'label':
            se = SearchEngineFactory().create()
            data = JSONSerializer().serializeToPython(self)            
            if scheme == None:
                scheme = self.get_scheme_id()
            if scheme == None:
                raise Exception('Index of label failed.  Index type (scheme id) could not be derived from the label.')

            se.create_mapping('concept_labels', scheme.id, fieldname='conceptid', fieldtype='string', fieldindex='not_analyzed')
            se.index_data('concept_labels', scheme.id, data, 'id')
            # don't create terms for entity type concepts
            if not(scheme.id == '00000000-0000-0000-0000-000000000003' or scheme.id == '00000000-0000-0000-0000-000000000004'):
                se.index_term(self.value, self.id, scheme.id, {'conceptid': self.conceptid})
コード例 #3
0
    def index(self, scheme=None):
        if self.category == 'label':
            se = SearchEngineFactory().create()
            data = JSONSerializer().serializeToPython(self)            
            if scheme == None:
                scheme = self.get_scheme_id()
            if scheme == None:
                raise Exception('Index of label failed.  Index type (scheme id) could not be derived from the label.')

            se.create_mapping('concept_labels', scheme.id, fieldname='conceptid', fieldtype='string', fieldindex='not_analyzed')
            se.index_data('concept_labels', scheme.id, data, 'id')
            # don't create terms for entity type concepts
            if not(scheme.id == '00000000-0000-0000-0000-000000000003' or scheme.id == '00000000-0000-0000-0000-000000000004'):
                se.index_term(self.value, self.id, scheme.id, {'conceptid': self.conceptid})
コード例 #4
0
    def index(self, scheme=None):
        if self.category == 'label':
            se = SearchEngineFactory().create()
            data = JSONSerializer().serializeToPython(self)            
            if scheme == None:
                scheme = self.get_scheme_id()
            if scheme == None:
                raise Exception('Index of label failed.  Index type (scheme id) could not be derived from the label.')

            se.create_mapping('concept_labels', scheme.id, fieldname='conceptid', fieldtype='string', fieldindex='not_analyzed')
            se.index_data('concept_labels', scheme.id, data, 'id')
            #Looks up whether the label is actually a dropdown label or an entity label and, if so, excludes them from the term search index.
            entity_or_dropdown= archesmodels.ConceptRelations.objects.filter(Q(relationtype ='hasCollection') | Q(relationtype ='hasEntity'),conceptidto = scheme.id)
            is_entity_or_dropdown = False if entity_or_dropdown.count() == 0 else True
            # don't create terms for entity type concepts
            if not(scheme.id == '00000000-0000-0000-0000-000000000003' or scheme.id == '00000000-0000-0000-0000-000000000004') and is_entity_or_dropdown ==False:
                se.index_term(self.value, self.id, scheme.id, {'conceptid': self.conceptid})
コード例 #5
0
ファイル: concept.py プロジェクト: azerbini/eamena2
    def index(self, scheme=None):
        if self.category == 'label':
            se = SearchEngineFactory().create()
            data = JSONSerializer().serializeToPython(self)            
            if scheme == None:
                scheme = self.get_scheme_id()
            if scheme == None:
                raise Exception('Index of label failed.  Index type (scheme id) could not be derived from the label.')

            se.create_mapping('concept_labels', scheme.id, fieldname='conceptid', fieldtype='string', fieldindex='not_analyzed')
            se.index_data('concept_labels', scheme.id, data, 'id')
            #Looks up whether the label is actually a dropdown label or an entity label and, if so, excludes them from the term search index.
            entity_or_dropdown= archesmodels.ConceptRelations.objects.filter(Q(relationtype ='hasCollection') | Q(relationtype ='hasEntity'),conceptidto = scheme.id)
            is_entity_or_dropdown = False if entity_or_dropdown.count() == 0 else True
            # don't create terms for entity type concepts
            if not(scheme.id == '00000000-0000-0000-0000-000000000003' or scheme.id == '00000000-0000-0000-0000-000000000004') and is_entity_or_dropdown ==False:
                se.index_term(self.value, self.id, scheme.id, {'conceptid': self.conceptid})
コード例 #6
0
    def index(self):
        """
        Indexes all the nessesary documents related to resources to support the map, search, and reports

        """

        se = SearchEngineFactory().create()

        search_documents = self.prepare_documents_for_search_index()
        for document in search_documents:
            se.index_data('resource',
                          self.resourceinstance.graph_id,
                          document,
                          id=self.resourceinstance_id)

        for term in self.prepare_terms_for_search_index():
            term_id = '%s_%s' % (str(self.tileid), str(term['nodeid']))
            se.delete_terms(term_id)
            se.index_term(term['term'], term_id, term['context'],
                          term['options'])
コード例 #7
0
ファイル: resource.py プロジェクト: oswalpalash/arches
    def index(self):
        """
        Indexes all the nessesary documents related to resources to support the map, search, and reports

        """

        se = SearchEngineFactory().create()

        search_documents = self.prepare_documents_for_search_index()
        for document in search_documents:
            se.index_data('entity', self.entitytypeid, document, id=self.entityid)

            report_documents = self.prepare_documents_for_report_index(geom_entities=document['geometries'])
            for report_document in report_documents:
                se.index_data('resource', self.entitytypeid, report_document, id=self.entityid)

            geojson_documents = self.prepare_documents_for_map_index(geom_entities=document['geometries'])
            for geojson in geojson_documents:
                se.index_data('maplayers', self.entitytypeid, geojson, idfield='id')

        for term in self.prepare_terms_for_search_index():
           se.index_term(term['term'], term['entityid'], term['context'], term['options'])