def add_data_to_index(cls, entity, data): if not isinstance(entity, model.Delegateable): return tags = [] for tag, count in entity.tags: tags.extend([ref_attr_value(tag)] * count) data[cls.solr_field] = tags
def add_data_to_index(cls, entity, data): if not isinstance(entity, model.Delegateable): return data[cls.solr_field] = [ref_attr_value(badge) for badge in entity.creator.badges if (badge.instance is entity.instance or badge.instance is None)]
def add_data_to_index(cls, entity, data): if not isinstance(entity, model.Delegateable): return data[cls.solr_field] = [ ref_attr_value(badge) for badge in entity.creator.badges if (badge.instance is entity.instance or badge.instance is None) ]
def _current_items(self): ''' Return a list of facets to display. ''' def show_facet(current_count, facet_count, show_empty, show_current_empty): if show_empty: return True if current_count > 0 or show_current_empty: return True if facet_count > 0 or show_empty: return True return False ids = [] facet_items = {} for (value, facet_count) in self.sorted_facet_counts: current_count = self.current_counts[value] if show_facet(current_count, facet_count, self.show_empty, self.show_current_empty): id_ = value ids.append(id_) facet_items[id_] = { 'current_count': current_count, 'value': value } result = [] entities = model.refs.get_entities(self.entity_type, ids) for entity in entities: item = facet_items[ref_attr_value(entity)] item['link_text'] = self.get_item_label(entity) item['disabled'] = (item['current_count'] == 0) item['selected'] = item['value'] in self.used item['url'] = self.get_item_url(item) result.append(item) return result
def _current_items(self): ''' Return a list of facets to display. ''' def show_facet(current_count, facet_count, show_empty, show_current_empty): if show_empty: return True if current_count > 0 or show_current_empty: return True if facet_count > 0 or show_empty: return True return False ids = [] facet_items = {} for (value, facet_count) in self.sorted_facet_counts: current_count = self.current_counts[value] if show_facet(current_count, facet_count, self.show_empty, self.show_current_empty): id_ = value ids.append(id_) facet_items[id_] = {'current_count': current_count, 'value': value} result = [] entities = model.refs.get_entities(self.entity_type, ids) for entity in entities: item = facet_items[ref_attr_value(entity)] item['link_text'] = self.get_item_label(entity) item['disabled'] = (item['current_count'] == 0) item['selected'] = item['value'] in self.used item['url'] = self.get_item_url(item) result.append(item) return result
def add_data_to_index(cls, entity, data): if not isinstance(entity, model.Delegateable): return d = [ref_attr_value(badge) for badge in entity.badges] data[cls.solr_field] = d
def add_data_to_index(cls, user, index): if not isinstance(user, model.User): return index[cls.solr_field] = [ref_attr_value(instance) for instance in user.instances]
def add_data_to_index(cls, instance, index): if not isinstance(instance, model.Instance): return d = [ref_attr_value(badge) for badge in instance.badges] index[cls.solr_field] = d
def add_data_to_index(cls, user, index): if not isinstance(user, model.User): return index[cls.solr_field] = [ ref_attr_value(instance) for instance in user.instances ]