/driver-core/src/main/com/mongodb/client/model/search/CompoundSearchOperatorBase.java

https://github.com/jyemin/mongo-java-driver · Java · 71 lines · 11 code · 5 blank · 55 comment · 0 complexity · 331a2196318ff95905cd3da636415040 MD5 · raw file

  1. /*
  2. * Copyright 2008-present MongoDB, Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.mongodb.client.model.search;
  17. import com.mongodb.annotations.Beta;
  18. import com.mongodb.annotations.Evolving;
  19. /**
  20. * A base for a {@link CompoundSearchOperator} which allows creating instances of this operator.
  21. * This interface is a technicality and does not represent a meaningful element of the full-text search query syntax.
  22. *
  23. * @see SearchOperator#compound()
  24. * @since 4.7
  25. */
  26. @Evolving
  27. @Beta(Beta.Reason.CLIENT)
  28. public interface CompoundSearchOperatorBase {
  29. /**
  30. * Creates a new {@link CompoundSearchOperator} by adding to it {@code clauses} that must all be satisfied.
  31. * <p>
  32. * This method may be called multiple times.</p>
  33. *
  34. * @param clauses The non-empty clauses to add.
  35. * @return A new {@link CompoundSearchOperator}.
  36. */
  37. MustCompoundSearchOperator must(Iterable<? extends SearchOperator> clauses);
  38. /**
  39. * Creates a new {@link CompoundSearchOperator} by adding to it {@code clauses} that must all not be satisfied.
  40. * <p>
  41. * This method may be called multiple times.</p>
  42. *
  43. * @param clauses The non-empty clauses to add.
  44. * @return A new {@link CompoundSearchOperator}.
  45. */
  46. MustNotCompoundSearchOperator mustNot(Iterable<? extends SearchOperator> clauses);
  47. /**
  48. * Creates a new {@link CompoundSearchOperator} by adding to it {@code clauses} that are preferred to be satisfied.
  49. * <p>
  50. * This method may be called multiple times.</p>
  51. *
  52. * @param clauses The non-empty clauses to add.
  53. * @return A new {@link CompoundSearchOperator}.
  54. */
  55. ShouldCompoundSearchOperator should(Iterable<? extends SearchOperator> clauses);
  56. /**
  57. * Creates a new {@link CompoundSearchOperator} by adding to it {@code clauses} that, similarly to {@link #must(Iterable)},
  58. * must all be satisfied. The difference is that this method does not affect the relevance score.
  59. * <p>
  60. * This method may be called multiple times.</p>
  61. *
  62. * @param clauses The non-empty clauses to add.
  63. * @return A new {@link CompoundSearchOperator}.
  64. */
  65. FilterCompoundSearchOperator filter(Iterable<? extends SearchOperator> clauses);
  66. }