Beispiel #1
0
 private static void UpdateEntry(UpdateIndexEntry update, List <WriteModel <MongoTextIndexEntity <T> > > writes)
 {
     writes.Add(
         new UpdateOneModel <MongoTextIndexEntity <T> >(
             Filter.Eq(x => x.DocId, update.DocId),
             Update
             .Set(x => x.ServeAll, update.ServeAll)
             .Set(x => x.ServePublished, update.ServePublished)));
 }
Beispiel #2
0
        private static void UpdateEntry(UpdateIndexEntry update, IList <IndexDocumentsAction <SearchDocument> > batch)
        {
            var document = new SearchDocument
            {
                ["docId"]          = update.DocId.ToBase64(),
                ["serveAll"]       = update.ServeAll,
                ["servePublished"] = update.ServePublished,
            };

            batch.Add(IndexDocumentsAction.MergeOrUpload(document));
        }
Beispiel #3
0
        private async Task UpdateAsync(UpdateIndexEntry update)
        {
            var data = new
            {
                doc = new
                {
                    update.ServeAll,
                    update.ServePublished
                }
            };

            var result = await client.UpdateAsync <StringResponse>(IndexName, update.DocId, CreatePost(data));

            if (!result.Success)
            {
                throw new InvalidOperationException($"Failed with ${result.Body}", result.OriginalException);
            }
        }
Beispiel #4
0
        private static void UpdateEntry(UpdateIndexEntry update, List <object> args, string indexName)
        {
            args.Add(new
            {
                update = new
                {
                    _id    = update.DocId,
                    _index = indexName
                }
            });

            args.Add(new
            {
                doc = new
                {
                    serveAll       = update.ServeAll,
                    servePublished = update.ServePublished
                }
            });
        }
Beispiel #5
0
        private void Update(UpdateIndexEntry update, List <object> args)
        {
            args.Add(new
            {
                update = new
                {
                    _id    = update.DocId,
                    _index = indexName,
                }
            });

            args.Add(new
            {
                doc = new
                {
                    serveAll       = update.ServeAll,
                    servePublished = update.ServePublished
                }
            });
        }