示例#1
0
        public SearchQueryForwarder(string searchPlatformConnectionString)
        {
            if (string.IsNullOrEmpty(searchPlatformConnectionString))
            {
                throw new ArgumentException("searchPlatformConnectionString");
            }

            if (!Uri.IsWellFormedUriString(searchPlatformConnectionString, UriKind.Absolute))
            {
                throw new ArgumentOutOfRangeException("searchPlatformConnectionString");
            }

            m_searchPlatform = SearchPlatformFactory.Create(searchPlatformConnectionString);
        }
示例#2
0
        //TODO: Code cleanup for default parameters
        public static IIndexProvisioner CreateIndexProvisioner(IndexProvisionParams provision, ISearchPlatform searchPlatform = null)
        {
            if (null == provision)
            {
                throw new ArgumentNullException("provison is NULL", "provision");
            }

            if (provision.ProvisionType != IndexProvisionType.SingleIndexPerAccount)
            {
                throw new ArgumentException(
                          string.Format(CultureInfo.InvariantCulture,
                                        "Provision Type {0} is not supported", provision.ProvisionType.ToString()));
            }

            return(new SingleIndexPerAccountProvisioner(searchPlatform ?? GetSearchPlatform()));
        }
示例#3
0
        //TODO: Code cleanup for removing Default parameters
        public static IIndexBuilder CreateIndexBuilder(IndexBuilderParams indexParams, ISearchPlatform searchPlatform = null)
        {
            // Check for null parameters
            if (null == indexParams || string.IsNullOrWhiteSpace(indexParams.Account) ||
                string.IsNullOrWhiteSpace(indexParams.Collection) ||
                string.IsNullOrWhiteSpace(indexParams.Project) ||
                string.IsNullOrWhiteSpace(indexParams.Repo) ||
                string.IsNullOrWhiteSpace(indexParams.Branch))
            {
                throw new ArgumentException(
                          string.Format(CultureInfo.InvariantCulture, "IndexerFactory called with Invalid arguments for Index builder"));
            }

            if (0 >= indexParams.Size)
            {
                throw new ArgumentException(
                          string.Format(CultureInfo.InvariantCulture, "IndexerFactory called with Invalid repo size for Index builder"), "Size");
            }

            if (!Enum.IsDefined(typeof(IndexMappingType), indexParams.IndexMapper))
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Index Map {0} is not supported", indexParams.IndexMapper.ToString()));
            }

            if (!Enum.IsDefined(typeof(FileContract), indexParams.FileContract))
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "ES document mapping {0} is not supported", indexParams.FileContract.ToString()));
            }

            if ((indexParams.IndexMapper == IndexMappingType.Aliasing) &&
                (indexParams.FileContract == FileContract.SourceNoDedupe))
            {
                return(new IndexBuilder(
                           new SourceNoDedupeFileContracter(),
                           new AliasProvisioner(searchPlatform ?? GetSearchPlatform()),
                           indexParams
                           ));
            }

            throw new NotImplementedException(string.Format(CultureInfo.InvariantCulture, "IndexMapper: {0} FileContract: {1}",
                                                            indexParams.IndexMapper.ToString(),
                                                            indexParams.FileContract.ToString()));
        }
示例#4
0
 protected SearchQueryForwarder(ISearchPlatform searchPlatform)
 {
     m_searchPlatform = searchPlatform;
 }