/// <summary>
        /// Submits the documents.
        /// </summary>
        /// <param name="scope">The scope.</param>
        /// <param name="documentType">Type of the document.</param>
        /// <param name="documents">The documents.</param>
        public void SubmitDocuments(string scope, string documentType, IDocument[] documents)
        {
            foreach (var doc in documents)
            {
                _search.Index(scope, documentType, doc);
            }

            _search.Commit(scope);
            _search.Close(scope, documentType);
        }
示例#2
0
        public virtual void PublishDocuments(string scope, IDocument[] documents)
        {
            foreach (var doc in documents)
            {
                _searchProvider.Index(scope, DocumentType, doc);
            }

            _searchProvider.Commit(scope);
            _searchProvider.Close(scope, DocumentType);
        }
 public static void CreateSampleIndex(ISearchProvider provider, string scope)
 {
     provider.Index(scope, "catalogitem", CreateDocument("12345", "sample product", "red", 123.23m, 2, new [] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
     provider.Index(scope, "catalogitem", CreateDocument("sad121", "red shirt", "red", 10m, 3, new[] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
     provider.Index(scope, "catalogitem", CreateDocument("jdashf", "blue shirt", "blue", 23.12m, 8, new[] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
     provider.Index(scope, "catalogitem", CreateDocument("32894hjf", "black sox", "black", 243.12m, 10, new[] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
     provider.Commit(scope);
     provider.Close(scope, "catalogitem");
 }
 public static void CreateSampleIndex(ISearchProvider provider, string scope)
 {
     provider.Index(scope, "catalogitem", CreateDocument("12345", "sample product", "red", 123.23m, 2, new [] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
     provider.Index(scope, "catalogitem", CreateDocument("sad121", "red shirt", "red", 10m, 3, new[] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
     provider.Index(scope, "catalogitem", CreateDocument("jdashf", "blue shirt", "blue", 23.12m, 8, new[] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
     provider.Index(scope, "catalogitem", CreateDocument("32894hjf", "black sox", "black", 243.12m, 10, new[] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
     provider.Commit(scope);
     provider.Close(scope, "catalogitem");
 }
示例#5
0
        public static void CreateSampleIndex(ISearchProvider provider, string scope, string documentType)
        {
            provider.RemoveAll(scope, documentType);

            AddDocuments(provider, scope, documentType, "stuff");
            AddDocuments(provider, scope, documentType, "goods");

            provider.Commit(scope);
            provider.Close(scope, documentType);

            // sleep for index to be commited
            Thread.Sleep(2000);
        }
示例#6
0
        public static void CreateSampleIndex(ISearchProvider provider, string scope)
        {
            provider.RemoveAll(scope, "");
            provider.Index(scope, "catalogitem", CreateDocument("12345", "sample product", "red", new[] { new Price("price_usd_default", 123.23m) }, 2, new[] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
            provider.Index(scope, "catalogitem", CreateDocument("red3", "red shirt 2", "red", new[] { new Price("price_usd_default", 200m), new Price("price_usd_sale", 99m), new Price("price_eur_sale", 300m) }, 4, new[] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
            provider.Index(scope, "catalogitem", CreateDocument("sad121", "red shirt", "red", new[] { new Price("price_usd_default", 10m) }, 3, new[] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
            provider.Index(scope, "catalogitem", CreateDocument("jdashf", "blue shirt", "Blue", new[] { new Price("price_usd_default", 23.12m) }, 8, new[] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }, true));
            provider.Index(scope, "catalogitem", CreateDocument("32894hjf", "black sox", "black", new[] { new Price("price_usd_default", 243.12m) }, 10, new[] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
            provider.Index(scope, "catalogitem", CreateDocument("another", "black sox2", "silver", new[] { new Price("price_usd_default", 700m) }, 20, new[] { "sony/186d61d8-d843-4675-9f77-ec5ef603fda3", "apple/186d61d8-d843-4675-9f77-ec5ef603fda3" }));
            provider.Commit(scope);
            provider.Close(scope, "catalogitem");

            // sleep for index to be commited
            Thread.Sleep(2000);
        }