<commit_before>/**
 *
 */
package org.devgateway.ocds.persistence.mongo.repository;

import java.util.Collection;
import java.util.List;

import org.devgateway.ocds.persistence.mongo.Organization;
import org.devgateway.ocds.persistence.mongo.Organization.OrganizationType;
import org.springframework.data.mongodb.repository.Query;

/**
 * @author mpostelnicu
 *
 */
public interface OrganizationRepository extends GenericOrganizationRepository<Organization> {

    @Query(value = "{$and: [ { $or: [ {'_id' : ?0 }, " + "{'name': ?0 } ] }  , { 'types': ?1 } ]}")
    Organization findByIdOrNameAndTypes(String idName, OrganizationType type);

    @Query(value = "{ $or: [ {'_id' : ?0 }, " + "{'name': ?0} ] }")
    Organization findByIdOrName(String idName);
    
    @Query(value = "{ $or: [ {'_id' :  { $in : ?0 }}, " + "{'additionalIdentifiers.identifier._id': { $in : ?0 }} ] }")
    List<Organization> findByIdCollection(Collection<String> idCol);

    @Query(value = "{$and: [  { $or: [ {'_id' : ?0 }, "
            + "{'additionalIdentifiers.identifier._id': ?0} ] }, { 'types': ?1 } ] }")
    Organization findByAllIdsAndType(String id, OrganizationType type);
}
<commit_msg>OCVN-344 org index just on addtnl identifiers<commit_after>/**
 *
 */
package org.devgateway.ocds.persistence.mongo.repository;

import java.util.Collection;
import java.util.List;

import org.devgateway.ocds.persistence.mongo.Organization;
import org.devgateway.ocds.persistence.mongo.Organization.OrganizationType;
import org.springframework.data.mongodb.repository.Query;

/**
 * @author mpostelnicu
 *
 */
public interface OrganizationRepository extends GenericOrganizationRepository<Organization> {

    @Query(value = "{$and: [ { $or: [ {'_id' : ?0 }, " + "{'name': ?0 } ] }  , { 'types': ?1 } ]}")
    Organization findByIdOrNameAndTypes(String idName, OrganizationType type);

    @Query(value = "{ $or: [ {'_id' : ?0 }, " + "{'name': ?0} ] }")
    Organization findByIdOrName(String idName);
    
    @Query(value = "{'additionalIdentifiers.identifier._id': { $in : ?0 }}")
    List<Organization> findByIdCollection(Collection<String> idCol);

    @Query(value = "{$and: [{'additionalIdentifiers.identifier._id': ?0} , { 'types': ?1 } ] }")
    Organization findByAllIdsAndType(String id, OrganizationType type);
}

{'fraction_non_alphanumeric': 0.175704989154013, 'fraction_numerical': 0.00911062906724512, 'mean_word_length': 4.5299760191846525, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6445951', 'n_tokens_mistral': 763, 'n_tokens_neox': 761, 'n_words': 135}