本文整理汇总了C#中RiakObject.BinIndex方法的典型用法代码示例。如果您正苦于以下问题:C# RiakObject.BinIndex方法的具体用法?C# RiakObject.BinIndex怎么用?C# RiakObject.BinIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RiakObject
的用法示例。
在下文中一共展示了RiakObject.BinIndex方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RangeQuery
public void RangeQuery()
{
var Cluster = RiakCluster.FromConfig("riakConfig");
var Client = Cluster.CreateClient();
var bucket = "rsds";
Client.Batch(batch =>
{
for (var i = 1; i < 11; i++)
{
var d = DateTime.Now.AddDays(0 - i);
var doc = new RiakObject(bucket, i.ToString(), new { value = i, created_date = d });
var position = 100 + i;
doc.BinIndex("position").Set(position.ToString());
batch.Put(doc);
}
});
var query = new RiakMapReduceQuery()
.Inputs(RiakIndex.Range("bucket", "position", 100, 200))
.MapJs(m => m.Name("Riak.mapValuesJson").Keep(true));
var result = Client.MapReduce(query);
//var items = result.Value.PhaseResults.SelectMany(x => x.GetObjects<dynamic>);
}
示例2: RiakIndexNameManglingIsHandledAutomatically
public void RiakIndexNameManglingIsHandledAutomatically()
{
var riakObject = new RiakObject(Bucket, Key, "value");
riakObject.BinIndex("name").Set("jeremiah");
riakObject.BinIndex("state_bin").Set("oregon");
riakObject.IntIndex("age").Add(32);
riakObject.IntIndex("cats_int").Add(2);
riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("name").ShouldBeFalse();
riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("name_bin").ShouldBeTrue();
riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("state").ShouldBeFalse();
riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("state_bin").ShouldBeFalse();
riakObject.BinIndexes.Values.Select(v => v.RiakIndexName).Contains("state_bin_bin").ShouldBeTrue();
riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("age").ShouldBeFalse();
riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("age_int").ShouldBeTrue();
riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("cats").ShouldBeFalse();
riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("cats_int").ShouldBeFalse();
riakObject.IntIndexes.Values.Select(v => v.RiakIndexName).Contains("cats_int_int").ShouldBeTrue();
}
示例3: BinIndexGetReturnsListOfKeys
public void BinIndexGetReturnsListOfKeys()
{
for (var i = 0; i < 10; i++)
{
var o = new RiakObject(Bucket, i.ToString(), "{ value: \"this is an object\" }");
o.BinIndex("age").Set("32");
Client.Put(o);
}
var result = Client.IndexGet(Bucket, "age", "32");
result.IsSuccess.ShouldBeTrue(result.ErrorMessage);
result.Value.Count.ShouldEqual(10);
foreach (var v in result.Value)
{
var key = int.Parse(v);
key.ShouldBeLessThan(10);
key.ShouldBeGreaterThan(-1);
}
}
示例4: RiakIndexingSupportsMultipleValuesCorrectly
public void RiakIndexingSupportsMultipleValuesCorrectly()
{
var riakObject = new RiakObject(Bucket, Key, "value");
riakObject.BinIndex("jobs").Set("dogsbody");
riakObject.BinIndex("jobs").Values.Count.ShouldEqual(1);
riakObject.BinIndex("jobs").Add("toilet cleaner", "president", "juggler");
riakObject.BinIndex("jobs").Values.Count.ShouldEqual(4);
riakObject.BinIndex("jobs").Remove("dogsbody", "juggler");
riakObject.BinIndex("jobs").Values.Count.ShouldEqual(2);
riakObject.BinIndex("jobs").Set("general", "engineer", "cook");
riakObject.BinIndex("jobs").Values.Count.ShouldEqual(3);
riakObject.BinIndex("jobs").Values.Contains("general").ShouldBeTrue();
riakObject.BinIndex("jobs").Clear();
riakObject.BinIndex("jobs").Values.Count.ShouldEqual(0);
riakObject.BinIndex("jobs").Delete();
riakObject.BinIndexes.ContainsKey("jobs").ShouldBeFalse();
riakObject.IntIndex("years").Set(10);
riakObject.IntIndex("years").Values.Count.ShouldEqual(1);
riakObject.IntIndex("years").Add(20, 40, 999);
riakObject.IntIndex("years").Values.Count.ShouldEqual(4);
riakObject.IntIndex("years").Remove(40, 999);
riakObject.IntIndex("years").Values.Count.ShouldEqual(2);
riakObject.IntIndex("years").Set(51, 52, 53);
riakObject.IntIndex("years").Values.Count.ShouldEqual(3);
riakObject.IntIndex("years").Values.Contains(52).ShouldBeTrue();
riakObject.IntIndex("years").Clear();
riakObject.IntIndex("years").Values.Count.ShouldEqual(0);
riakObject.IntIndex("years").Delete();
riakObject.IntIndexes.ContainsKey("years").ShouldBeFalse();
}
示例5: SecondaryIndexesAreForcedToLowerCase
public void SecondaryIndexesAreForcedToLowerCase()
{
var obj = new RiakObject(Bucket, Key);
obj.BinIndex("UPPERCASE").Set("foo");
obj.IntIndex("MixedCase").Set(10);
obj.BinIndexes.ContainsKey("uppercase").ShouldBeTrue();
obj.IntIndexes.ContainsKey("mixedcase").ShouldBeTrue();
obj.BinIndex("UPPERCASE").Values.First().ShouldEqual("foo");
obj.BinIndex("uppercase").Values.First().ShouldEqual("foo");
obj.IntIndex("MixedCase").Values.First().ShouldEqual(10);
obj.IntIndex("mixedcase").Values.First().ShouldEqual(10);
}
示例6: IndexesAreSavedWithAnObject
public void IndexesAreSavedWithAnObject()
{
var o = new RiakObject(Bucket, "the_object", "{ value: \"this is an object\" }");
o.BinIndex("tacos").Set("are great!");
o.IntIndex("age").Set(12);
Client.Put(o);
var result = Client.Get(o.ToRiakObjectId());
result.IsSuccess.ShouldBeTrue(result.ErrorMessage);
var ro = result.Value;
ro.BinIndexes.Count.ShouldEqual(1);
ro.IntIndexes.Count.ShouldEqual(1);
}
示例7: PutObjectsWithIndexValues
private ICollection<RiakObjectId> PutObjectsWithIndexValues()
{
var ids = new List<RiakObjectId>();
var larryId = new RiakObjectId("indexes", "people", "larry");
var larry = new RiakObject(larryId, "My name is Larry",
RiakConstants.ContentTypes.TextPlain);
larry.BinIndex("field1").Set("val1");
larry.IntIndex("field2").Set(1001);
ids.Add(larryId);
CheckResult(client.Put(larry));
var moeId = new RiakObjectId("indexes", "people", "moe");
var moe = new RiakObject(moeId, "My name is Moe",
RiakConstants.ContentTypes.TextPlain);
moe.BinIndex("Field1").Set("val2");
moe.IntIndex("Field2").Set(1002);
ids.Add(moeId);
CheckResult(client.Put(moe));
var curlyId = new RiakObjectId("indexes", "people", "curly");
var curly = new RiakObject(curlyId, "My name is Curly",
RiakConstants.ContentTypes.TextPlain);
curly.BinIndex("FIELD1").Set("val3");
curly.IntIndex("FIELD2").Set(1003);
ids.Add(curlyId);
CheckResult(client.Put(curly));
var veronicaId = new RiakObjectId("indexes", "people", "veronica");
var veronica = new RiakObject(veronicaId, "My name is Curly",
RiakConstants.ContentTypes.TextPlain);
veronica.BinIndex("FIELD1").Set(new string[] { "val4", "val4" });
veronica.IntIndex("FIELD2").Set(new BigInteger[] {
1004, 1005, 1006, 1004, 1004, 1007
});
ids.Add(veronicaId);
CheckResult(client.Put(veronica));
return ids;
}
示例8: PutJohnSmith
private void PutJohnSmith()
{
id = new RiakObjectId("default", "users", "john_smith");
var obj = new RiakObject(id, "...user data...",
RiakConstants.ContentTypes.TextPlain);
obj.BinIndex("twitter").Set("jsmith123");
obj.BinIndex("email").Set("[email protected]");
CheckResult(client.Put(obj));
}