Exemple #1
0
        static void TestCase2()
        {
            List <string> docsToIndex      = DocumentsToIndex("./TestCases/2/");
            List <string> queriesToProcess = QueriesToProcess("./TestCases/2/");
            ParseOptions  options          = new ParseOptions();

            // load documents
            foreach (string curr in docsToIndex)
            {
                byte[]         data   = Common.ReadBinaryFile(curr);
                SourceDocument src    = new SourceDocument("test", "test", curr, curr, null, DocType.Json, null, "application/json", data.Length, Common.Md5(data));
                IndexResult    result = _IndexClient.Add(src, data, options, true).Result;
                Console.WriteLine("");
                Console.WriteLine("Add: " + curr);
                Console.WriteLine(Common.SerializeJson(result, true));
            }

            Console.WriteLine("");
            Console.WriteLine("Press ENTER to continue");
            Console.ReadLine();

            // execute queries
            foreach (string curr in queriesToProcess)
            {
                EnumerationQuery  query  = Common.DeserializeJson <EnumerationQuery>(Common.ReadBinaryFile(curr));
                EnumerationResult result = _IndexClient.Enumerate(query);
                Console.WriteLine("");
                Console.WriteLine("Query: " + curr);
                Console.WriteLine(Common.SerializeJson(result, true));
            }
        }
Exemple #2
0
        /// <summary>
        /// Enumerate the index.
        /// </summary>
        /// <param name="indexName">Name of the index.</param>
        /// <param name="query">Enumeration query.</param>
        /// <returns>Enumeraiton result.</returns>
        public EnumerationResult Enumerate(string indexName, EnumerationQuery query)
        {
            if (String.IsNullOrEmpty(indexName))
            {
                throw new ArgumentNullException(nameof(indexName));
            }
            if (query == null)
            {
                throw new ArgumentNullException(nameof(query));
            }
            KomodoIndex idx = GetIndexClient(indexName);

            return(idx.Enumerate(query));
        }