Exemplo n.º 1
0
        /// <summary>
        /// The term suggester suggests terms based on edit distance. The provided suggest text is analyzed before terms are suggested.
        /// The suggested terms are provided per analyzed suggest text token. The term suggester doesn’t take the query into account that is part of request.
        /// </summary>
        public SuggestDescriptor <T> Term(string name, Func <TermSuggestDescriptor <T>, TermSuggestDescriptor <T> > suggest)
        {
            name.ThrowIfNullOrEmpty("name");
            suggest.ThrowIfNull("suggest");
            var desc   = new TermSuggestDescriptor <T>();
            var item   = suggest(desc);
            var bucket = new SuggestDescriptorBucket <T> {
                _Text = item._Text, TermSuggest = item
            };

            this._Suggest.Add(name, bucket);
            return(this);
        }
Exemplo n.º 2
0
        /// <summary>
        /// The term suggester suggests terms based on edit distance. The provided suggest text is analyzed before terms are suggested.
        /// The suggested terms are provided per analyzed suggest text token. The term suggester doesn’t take the query into account that is part of request.
        /// </summary>
        public SearchDescriptor <T> SuggestTerm(string name, Func <TermSuggestDescriptor <T>, TermSuggestDescriptor <T> > suggest)
        {
            name.ThrowIfNullOrEmpty("name");
            suggest.ThrowIfNull("suggest");
            if (this._Suggest == null)
            {
                this._Suggest = new Dictionary <string, object>();
            }
            var desc   = new TermSuggestDescriptor <T>();
            var item   = suggest(desc);
            var bucket = new SuggestDescriptorBucket <T> {
                _Text = item._Text, TermSuggest = item
            };

            this._Suggest.Add(name, bucket);
            return(this);
        }
Exemplo n.º 3
0
        public SearchDescriptor <T> PhraseSuggest(string name, Func <PhraseSuggestDescriptor <T>, PhraseSuggestDescriptor <T> > suggest)
        {
            name.ThrowIfNullOrEmpty("name");
            suggest.ThrowIfNull("suggest");
            if (this._Suggest == null)
            {
                this._Suggest = new Dictionary <string, SuggestDescriptorBucket <T> >();
            }
            PhraseSuggestDescriptor <T> desc   = new PhraseSuggestDescriptor <T>();
            PhraseSuggestDescriptor <T> item   = suggest(desc);
            SuggestDescriptorBucket <T> bucket = new SuggestDescriptorBucket <T> {
                _Text = item._Text, PhraseSuggest = item
            };

            this._Suggest.Add(name, bucket);
            return(this);
        }