예제 #1
0
        public async Task <IActionResult> Condition(string search, int?fuzziness)
        {
            var match = new MatchQuery(search);

            if (fuzziness.HasValue)
            {
                match.Fuzziness(fuzziness.Value);
            }
            var query = new SearchQuery
            {
                Index        = "medical-condition",
                Query        = match,
                SearchParams = new SearchParams().Fields("information.firstname", "information.lastname", "notes.message")
            };

            query.Highlighting(HighLightStyle.Html, "notes.message");
            var result = await _bucket.QueryAsync(query);

            if (result.Success)
            {
                return(Ok(result.Hits));
            }
            return(CouchbaseError(result));
        }
        public void Fuzziness_WhenLessThanZero_ThrowsArgumentOutOfRangeException()
        {
            var query = new MatchQuery("theterm");

            Assert.Throws <ArgumentOutOfRangeException>(() => query.Fuzziness(-1));
        }