Last active
October 18, 2017 13:32
-
-
Save hhblaze/f306b5df8b1e77600160c24486b6d198 to your computer and use it in GitHub Desktop.
Testing Cascade DBreeze Exclude
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```C# | |
using DBreeze; | |
using DBreeze.Utils; | |
using System.Diagnostics; | |
DBreezeEngine eng = new DBreezeEngine(@"D:\Temp\DBR1"); | |
//INSERTING ONCE | |
//using (var tran = eng.GetTransaction()) | |
//{ | |
// tran.TextInsert("txt", new byte[]{1}, "entity_1", "#GR_14 #U_RU #U_EN #U_DE"); | |
// tran.TextInsert("txt", new byte[]{2}, "entity_2", "#GR_14 #U_RU #U_EN #U_DE"); | |
// tran.TextInsert("txt", new byte[]{3}, "entity_3", "#GR_14 #U_RU #U_EN #U_DE"); | |
// tran.TextInsert("txt", new byte[]{4}, "entity_4", "#GR_15 #U_RU #U_EN #U_DE"); | |
// tran.TextInsert("txt", new byte[]{5}, "entity_5", "#GR_15 #U_RU #U_EN #U_DE"); | |
// tran.TextInsert("txt", new byte[]{6}, "entity_6", "#GR_15 #U_RU #U_EN #U_DE"); | |
// tran.TextInsert("txt", new byte[]{7}, "entity_7", "#GR_16 #U_RU #U_EN #U_DE"); | |
// tran.TextInsert("txt", new byte[]{8}, "entity_8", "#GR_16 #U_RU #U_EN #U_DE"); | |
// tran.TextInsert("txt", new byte[] {9 }, "entity_9", "#GR_16 #U_RU #U_EN #U_DE"); | |
// tran.Commit(); | |
//} | |
using (var tran = eng.GetTransaction()) | |
{ | |
var ts = tran.TextSearch("txt"); | |
//TEST1 | |
//var q = ts.Block("entity_4"); | |
//foreach (var el in q.GetDocumentIDs()) | |
//{ | |
// Debug.WriteLine(el.ToBytesString()); | |
//} | |
//TEST2 | |
//Show from all groups with untranslated DE | |
//var q = ts.Block("", "#U_DE"); | |
//foreach (var el in q.GetDocumentIDs().Take(1000)) | |
//{ | |
// Debug.WriteLine(el.ToBytesString()); | |
//} | |
//MAIN TEST | |
//show all entities with UntranslatedDE except such group "#GR_15", "#GR_16" | |
List<string> excludedGroups = new List<string> { "#GR_15", "#GR_16" }; | |
var q = ts.Block("", "#U_DE"); | |
foreach(var egr in excludedGroups) | |
{ | |
q = q.Exclude("", egr); | |
} | |
foreach (var el in q.GetDocumentIDs().Take(1000)) | |
{ | |
Debug.WriteLine(el.ToBytesString()); | |
} | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment