/// <summary> /// Constructor for build index. /// Based on BuildIndexParams objects of different internal objects will be created. /// </summary> /// <param name="provisioner">Provisioner object</param> /// <param name="contracter">Contracter object</param> /// <param name="indexMapper">Index Mapper object</param> /// <param name="buildIndexParams">Parameters for building the index</param> public IndexBuilder(IFileContracter contracter, IIndexMapper indexMapper, IndexBuilderParams indexBuilderParams) { m_indexInitialized = false; m_IndexName = indexBuilderParams.Index; m_fileContracter = contracter; // TODO: [Satish - 7/22/2014] Pass the correct mapper from feeder service appropriately. m_indexMapper = indexMapper; m_indexBuilderParams = indexBuilderParams; }
//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())); }