Example #1
0
        /// <summary>
        /// Allows adding new posting to the termEntry.
        /// </summary>
        /// <exception cref="System.ArgumentException">if posting is null</exception>
        private void AddPosting(TLPosting posting)
        {
            if (posting == null)
            {
                throw new ArgumentException("The posting cannot be null");
            }

            PostingsLookup.Add(posting.ArtifactId, posting);
            m_postings.Add(posting);
        }
Example #2
0
        /// <summary>
        /// Allows adding new posting to the termEntry.
        /// </summary>
        /// <param name="artifactId">artifact id</param>
        /// <param name="frequency">frequency of the term in the given artifact</param>
        /// <param name="weight">local weight of the term in the posting</param>
        /// <returns>created posting</returns>
        /// <exception cref="System.ArgumentException">if documentId is null or empty; or if frequency is less than 0</exception>
        public TLPosting AddPosting(string artifactId, int frequency, double weight)
        {
            if (artifactId == null || artifactId == "")
            {
                throw new ArgumentException("The documentId cannot be empty or null");
            }
            if (frequency <= 0)
            {
                throw new ArgumentException("Frequency has to be greater than 0.");
            }

            TLPosting posting = new TLPosting(artifactId, frequency, weight);

            PostingsLookup.Add(artifactId, posting);
            m_postings.Add(posting);

            return(posting);
        }