예제 #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 MaperByKey(SearchTable table)
 {
     this.table = table;
 }