word.cs

来自「本系统是在asp版《在线文件管理器》的基础上设计制作」· CS 代码 · 共 78 行

CS
78
字号
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using CommunityServer.Components;

namespace CommunityServer.Components {

    public class Word {
        int occurrence = 0;
        int _occurenceWeight = 0;
        string word;

        public Word(string word, WordLocation location) {
            this.word = word;
            IncrementOccurence(location);
        }

        public void IncrementOccurence(WordLocation location) {

            //ScottW:
            //This may need to be Application specific since only blog has Excerpt. 
            //It should not break the search logic, but just a little messy to drop it
            //in here.
            switch(location)
            {
                case WordLocation.Section:
                        _occurenceWeight += 5;
                    break;
                case WordLocation.Excerpt:
                    _occurenceWeight += 5;
                    break;
                case WordLocation.Subject:
                    _occurenceWeight += 10;
                    break;
                default:
                    _occurenceWeight++;
                    break;

            }
        }

        public string Name {
            get {
                return word;
            }
        }

        public int OccurenceWeight {
            get {
                return _occurenceWeight;
            }
        }

        public int Occurence {
            get {
                return occurrence;
            }
        }

        private double _weight;
        /// <summary>
        /// Property Weight (double)
        /// </summary>
        public double Weight
        {
            get {  return this._weight; }
            set {  this._weight = value; }
        }

    }


}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?