Beispiel #1
0
        public IInvertedIndex CreateIndex(IndexType kind)
        {
            LanguageFactory    _languageFactory = new LanguageFactory();
            PageProcesser      processer        = new PageProcesser();
            IEnumerable <Page> allPages         = fetchPages();
            IInvertedIndex     index            = null;

            if (kind.Equals(IndexType.Boolean))
            {
                index = new InvertedIndexBoolean();
            }
            else if (kind.Equals(IndexType.ContentBased))
            {
                index = new InvertedIndexTF(allPages.Count());
            }

            //var temp = allPages.Take(100);

            Parallel.ForEach(allPages, p =>
            {
                ILanguageBehaviour language = _languageFactory.GetLanguage(p.Url);
                p.Tokens = processer.PreprocessPage(p.SiteText, language);
                index.AddDocumentToIndex(p);
            });

            if (kind.Equals(IndexType.ContentBased))
            {
                index.InitialiseIndex();
            }

            return(index);
        }
Beispiel #2
0
 protected bool Equals(ColumnInfo other)
 {
     return(string.Equals(TableName, other.TableName) &&
            string.Equals(TableSchema, other.TableSchema) &&
            string.Equals(ColumnName, other.ColumnName) &&
            string.Equals(ColumnType, other.ColumnType) &&
            string.Equals(PropertyName, other.PropertyName) &&
            IsNullable.Equals(other.IsNullable) &&
            IsIdentity.Equals(other.IsIdentity) &&
            IndexType.Equals(other.IndexType));
 }
        /// <summary>
        ///     Returns true if IndexingPolicy instances are equal
        /// </summary>
        /// <param name="other">Instance of IndexingPolicy to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(IndexingPolicy other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return
                ((
                     Automatic == other.Automatic ||
                     Automatic != null &&
                     Automatic.Equals(other.Automatic)
                     ) &&
                 (
                     IndexingMode == other.IndexingMode ||
                     IndexingMode != null &&
                     IndexingMode.SequenceEqual(other.IndexingMode)
                 ) &&
                 (
                     IncludePaths == other.IncludePaths ||
                     IncludePaths != null &&
                     IncludePaths.Equals(other.IncludePaths)
                 ) &&
                 (
                     IndexType == other.IndexType ||
                     IndexType != null &&
                     IndexType.Equals(other.IndexType)
                 ) &&
                 (
                     NumericPrecision == other.NumericPrecision ||
                     NumericPrecision != null &&
                     NumericPrecision.Equals(other.NumericPrecision)
                 ) &&
                 (
                     StringPrecision == other.StringPrecision ||
                     StringPrecision != null &&
                     StringPrecision.Equals(other.StringPrecision)
                 ) &&
                 (
                     Path == other.Path ||
                     Path != null &&
                     Path.Equals(other.Path)
                 ) &&
                 (
                     ExcludePaths == other.ExcludePaths ||
                     ExcludePaths != null &&
                     ExcludePaths.Equals(other.ExcludePaths)
                 ));
        }
Beispiel #4
0
        public bool TotallyEquals(IndexSet other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Equals(other) && IndexIsUnique.Equals(other.IndexIsUnique) && IndexType.Equals(other.IndexType) &&
                   Columns.Equals(other.Columns) && IncludedColumns.Equals(other.IncludedColumns) &&
                   HasFilter.Equals(other.HasFilter) && FilterDefinition.Equals(other.FilterDefinition) &&
                   KeyConstraintTypeCode.Equals(other.KeyConstraintTypeCode));
        }
Beispiel #5
0
 private bool Equals(IndexerSymbol other)
 {
     return(base.Equals(other) && IndexType.Equals(other.IndexType) && ValueType.Equals(other.ValueType) && ReadOnly == other.ReadOnly);
 }
Beispiel #6
0
        private void comboBoxIndexType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (checkBoxNull.Checked && DefaultValue == "" && IndexType != "None")
            {
                switch (comboBoxDataType.Text)
                {
                case "TinyInt":
                case "SmallInt":
                case "Int":
                case "BigInt":
                case "Float":
                    DefaultValue = "0";
                    break;

                case "DateTime":
                case "SmallDateTime":
                case "Date":
                    DefaultValue = "1900-1-1";
                    break;
                }
            }

            switch (comboBoxDataType.Text)
            {
            case "TinyInt":
            case "SmallInt":
            case "Int":
            case "BigInt":
            case "DateTime":
            case "SmallDateTime":
            case "Date":
            case "Float":
                numericUpDownDataLength.Minimum = 0;
                numericUpDownDataLength.Maximum = 0;
                numericUpDownDataLength.Value   = 0;
                if (IndexType.Equals("Tokenized", StringComparison.CurrentCultureIgnoreCase))
                {
                    MessageBox.Show("Tokenized field only can be set by string data types", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    comboBoxIndexType.Text = "None";
                    return;
                }

                break;

            case "NVarchar":
            case "Varchar":
            case "NChar":
            case "Char":

                if (IndexType.Equals("Untokenized", StringComparison.CurrentCultureIgnoreCase))
                {
                    numericUpDownDataLength.Minimum = 1;
                    numericUpDownDataLength.Maximum = 32;
                    numericUpDownDataLength.Value   = 1;
                }
                else
                {
                    numericUpDownDataLength.Minimum = -1;
                    numericUpDownDataLength.Maximum = 4000;
                    numericUpDownDataLength.Value   = -1;
                }
                break;
            }

            if (IndexType.Equals("Tokenized", StringComparison.CurrentCultureIgnoreCase))
            {
                comboBoxAnalyzer.Enabled = true;
            }
            else
            {
                comboBoxAnalyzer.Enabled = false;
            }
        }