/// <summary> /// Search the current field for an exact match to the <paramref name="value"/> token. /// </summary> /// <param name="value">The token to search for.</param> /// <returns>A constructed search <see cref="Term"/>.</returns> public Term Search(Token value) { this.term = new UnaryTerm(this, field, value); return this.term; }
/// <summary> /// Search the current field for values between <paramref name="from"/> and <paramref name="to"/>. /// </summary> /// <param name="from">The lower bound of values to search for.</param> /// <param name="to">The upper bound of values to search for.</param> /// <param name="inclusive">The option to include the bounds in the range or not.</param> /// <returns>A constructed search <see cref="Term"/>.</returns> public Term Between(string from, Token to, bool inclusive = true) { return Between(Token.Is(from), to, inclusive); }
/// <summary> /// Search the current field for values between <paramref name="from"/> and <paramref name="to"/>. /// </summary> /// <param name="from">The lower bound of values to search for.</param> /// <param name="to">The upper bound of values to search for.</param> /// <param name="inclusive">The option to include the bounds in the range or not.</param> /// <returns>A constructed search <see cref="Term"/>.</returns> public Term Between(Token from, Token to, bool inclusive = true) { this.term = new RangeTerm(this, field, from, to, inclusive); return this.term; }
/// <summary> /// Search the current field for the <paramref name="value"/> token, /// and group that query with another provided by <paramref name="groupSetup"/>. /// </summary> /// <param name="value">The token to search values for.</param> /// <param name="groupSetup"> /// A <see cref="Func{T1,T2}"/> that accepts a <see cref="Term"/> for fluent configuration, /// and returns that configured <see cref="Term"/>. /// </param> /// <returns>A constructed search <see cref="Term"/>.</returns> /// <remarks> /// Configure the phase with a lambda similar to: /// <code>new RiakFluentSearch("bucket", "key").Group("foo", t => t.Or("bar"));</code> /// The above filter will return the following grouped query string: /// <code>key:(key:foo OR key:bar)</code>. /// </remarks> public Term Group(Token value, Func<Term, Term> groupSetup) { var groupedTerm = groupSetup(new UnaryTerm(this, field, value)); grouped = true; this.term = new GroupTerm(this, field, groupedTerm); return this.term; }
/// <summary> /// Search the current field for values between <paramref name="from"/> and <paramref name="to"/>. /// </summary> /// <param name="from">The lower bound of values to search for.</param> /// <param name="to">The upper bound of values to search for.</param> /// <param name="inclusive">The option to include the bounds in the range or not.</param> /// <returns>A constructed search <see cref="Term"/>.</returns> public Term Between(Token from, string to, bool inclusive = true) { return Between(from, Token.Is(to), inclusive); }
/// <summary> /// Combines a Term searching this field for the <paramref name="value"/> Token, using a logical AND, /// with another Term generated by the <paramref name="groupSetup"/> Func. /// </summary> /// <param name="value">The value to match using the current field.</param> /// <param name="groupSetup"> /// A <see cref="Func{T1,T2}"/> that accepts a <see cref="Term"/> for fluent configuration, /// and returns a configured <see cref="Term"/>. /// </param> /// <returns> /// A new <see cref="BinaryTerm"/> based on the two created <see cref="Term"/>s. /// </returns> public BinaryTerm And(Token value, Func<Term, Term> groupSetup) { return And(field, value, groupSetup); }
/// <summary> /// Combines a Term searching the <paramref name="field"/> field for the <paramref name="value"/> Token, /// using a logical AND, with another Term generated by the <paramref name="groupSetup"/> Func. /// </summary> /// <param name="field">The other field to search.</param> /// <param name="value">The other value to match.</param> /// <param name="groupSetup"> /// A <see cref="Func{T1,T2}"/> that accepts a <see cref="Term"/> for fluent configuration, /// and returns a configured <see cref="Term"/>. /// </param> /// <returns> /// A new <see cref="BinaryTerm"/> based on the two created <see cref="Term"/>s. /// </returns> public BinaryTerm And(string field, Token value, Func<Term, Term> groupSetup) { var groupedTerm = groupSetup(new UnaryTerm(search, field, value)); var groupTerm = new GroupTerm(search, field, groupedTerm); return new BinaryTerm(search, field, BinaryTerm.Op.And, this, groupTerm); }
/// <summary> /// Combine this Term, using a logical AND, with a new Range Term /// searching <paramref name="field"/> for values between <paramref name="from"/> /// and <paramref name="to"/>. /// </summary> /// <param name="field">The other field to search.</param> /// <param name="from">The lower bound of values to search for.</param> /// <param name="to">The upper bound of values to search for.</param> /// <param name="inclusive">The option to include the bounds in the range or not.</param> /// <returns> /// A new <see cref="BinaryTerm"/> based on this Term and the provided parameters. /// </returns> public BinaryTerm AndBetween(string field, Token from, string to, bool inclusive = true) { return AndBetween(field, from, Token.Is(to), inclusive); }
/// <summary> /// Combine this Term, using a logical AND, with a new Range Term /// searching <paramref name="field"/> for values between <paramref name="from"/> /// and <paramref name="to"/>. /// </summary> /// <param name="field">The other field to search.</param> /// <param name="from">The lower bound of values to search for.</param> /// <param name="to">The upper bound of values to search for.</param> /// <param name="inclusive">The option to include the bounds in the range or not.</param> /// <returns> /// A new <see cref="BinaryTerm"/> based on this Term and the provided parameters. /// </returns> public BinaryTerm AndBetween(string field, Token from, Token to, bool inclusive = true) { var range = new RangeTerm(search, field, from, to, inclusive); return new BinaryTerm(search, field, BinaryTerm.Op.And, this, range); }
/// <summary> /// Combine this Term, using a logical AND, with a new Range Term /// searching <paramref name="field"/> for values between <paramref name="from"/> /// and <paramref name="to"/>. /// </summary> /// <param name="field">The other field to search.</param> /// <param name="from">The lower bound of values to search for.</param> /// <param name="to">The upper bound of values to search for.</param> /// <param name="inclusive">The option to include the bounds in the range or not.</param> /// <returns> /// A new <see cref="BinaryTerm"/> based on this Term and the provided parameters. /// </returns> public BinaryTerm AndBetween(string field, string from, Token to, bool inclusive = true) { return AndBetween(field, Token.Is(from), to, inclusive); }
/// <summary> /// Combine this Term, using a logical AND, with a new Range Term /// searching the current field for values between <paramref name="from"/> /// and <paramref name="to"/>. /// </summary> /// <param name="from">The lower bound of values to search for.</param> /// <param name="to">The upper bound of values to search for.</param> /// <param name="inclusive">The option to include the bounds in the range or not.</param> /// <returns> /// A new <see cref="BinaryTerm"/> based on this Term and the provided parameters. /// </returns> public BinaryTerm AndBetween(Token from, Token to, bool inclusive = true) { return AndBetween(field, from, to, inclusive); }
/// <summary> /// Combines this Term, using a logical AND, with a new one searching the /// <paramref name="field"/> field for the provided <paramref name="value"/> Token. /// </summary> /// <param name="field">The other field to search.</param> /// <param name="value">The other value to match.</param> /// <returns> /// A new <see cref="BinaryTerm"/> based on this Term and the provided <paramref name="value"/>. /// </returns> public BinaryTerm And(string field, Token value) { return new BinaryTerm(search, field, BinaryTerm.Op.And, this, value); }
/// <summary> /// Combines this Term, using a logical AND, with a new one searching this /// Term's field for the provided <paramref name="value"/> Token. /// </summary> /// <param name="value">The other value to match.</param> /// <returns> /// A new <see cref="BinaryTerm"/> based on this Term and the provided <paramref name="value"/>. /// </returns> public BinaryTerm And(Token value) { return And(field, value); }
/// <summary> /// Combines this Term, using a logical OR, with a new one searching /// this Term's field for the provided <paramref name="value"/> Token. /// </summary> /// <param name="value">The other value to match.</param> /// <returns> /// A new <see cref="BinaryTerm"/> based on this Term and the provided <paramref name="value"/>. /// </returns> public BinaryTerm Or(Token value) { return Or(field, value); }