Пример #1
0
        // Конструктор
        public SearchIndex(string name, Table <TValue> table, ISearchIndexTrigger <TValue> trigger, IRecordsComparer <TValue>[] recordsComparers)
        {
            this.Name         = name;
            this.table        = table;
            this.triggerSeach = trigger;
            this.searchTable  = new SearchTable(table.DataBase, name + "srh");
            this.hash         = new MapedMultyListIndex <string, TValue>(name, table, new MaperByKey(searchTable), recordsComparers, this)
            {
                DontRemoveKeys = true
            };
            this.WordSeparators   = new [] { ' ', ',', '.', '\\', '/', ':', ';', '!', '?', '#', '@', '$', '%', '^', '&', '*', '(', ')', '+', '-', '|', '_', '"', '\'', '[', ']', '{', '}', '\t', '\r', '\n' };
            this.WordMinLength    = 3;
            this.WordSuffixLength = 2;
            this.WordPrefixLength = 3;

            Fields = Helper.Concat(trigger.Fields);

            for (var i = 0; i < recordsComparers.Length; ++i)
            {
                recordsComparers[i].Owner = this;

                Fields = Helper.Concat(Fields, recordsComparers[i].Fields);
            }

            table.AddIndex(this);
        }
Пример #2
0
        // Конструктор
        public MultyMapMultyListIndex(string key, Table <TValue> table, MultyMapTrigger <TKey, TValue> trigger, IRecordsComparer <TValue>[] valuesTriggers)
        {
            this.trigger = trigger;
            this.Name    = key;
            this.Table   = table;
            this.trigger = trigger;
            this.hash    = new MapedMultyListIndex <TKey, TValue>(key, table, trigger, valuesTriggers, this);

            trigger.Owner = this;

            Fields = Helper.Concat(trigger.Fields);

            for (var i = 0; i < valuesTriggers.Length; ++i)
            {
                valuesTriggers[i].Owner = this;

                Fields = Helper.Concat(Fields, valuesTriggers[i].Fields);
            }

            table.AddIndex(this);
        }