コード例 #1
0
ファイル: BooleanQuery.cs プロジェクト: pchaozhong/FlexNet
        /// <summary>Adds a clause to a boolean query.</summary>
        /// <throws>  TooManyClauses if the new number of clauses exceeds the maximum clause number </throws>
        /// <seealso cref="GetMaxClauseCount()">
        /// </seealso>
        public virtual void  Add(BooleanClause clause)
        {
            if (clauses.Count >= maxClauseCount)
            {
                throw new TooManyClauses();
            }

            clauses.Add(clause);
        }
コード例 #2
0
ファイル: PhraseQuery.cs プロジェクト: pchaozhong/FlexNet
        /// <summary> Adds a term to the end of the query phrase.
        /// The relative position of the term within the phrase is specified explicitly.
        /// This allows e.g. phrases with more than one term at the same position
        /// or phrases with gaps (e.g. in connection with stopwords).
        ///
        /// </summary>
        /// <param name="term">
        /// </param>
        /// <param name="position">
        /// </param>
        public virtual void  Add(Term term, int position)
        {
            if (terms.Count == 0)
            {
                field = term.Field();
            }
            else if (term.Field() != field)
            {
                throw new System.ArgumentException("All phrase terms must be in the same field: " + term);
            }

            terms.Add(term);
            positions.Add((System.Int32)position);
            if (position > maxPosition)
            {
                maxPosition = position;
            }
        }
コード例 #3
0
 /// <summary>Add a subquery to this disjunction</summary>
 /// <param name="query">the disjunct added
 /// </param>
 public virtual void  Add(Query query)
 {
     disjuncts.Add(query);
 }