def make_query(base: str, addition_terms: Sequence[Term],
               subtraction_terms: Sequence[Term],
               or_terms: Sequence[Term]) -> str:
  """Modifies a `base`-query with addition and subtraction terms.

  Args:
    base:  Base query, as is, i.e. without manual escaping nor operators.
    addition_terms:  Sequence of terms which will be added to `base` with the
      "+" operator.
    subtraction_terms:  Sequence of terms which will be added to `base` with the
      "-" operator.
    or_terms: Sequence of terms which will be added to `base` directly without
      any operator.

  Returns:
    The properly modified base-query which can be issued to lucene.
  """
  escaped_base = utils.escape_for_lucene(base)

  modifications = []
  for subtraction_term, addition_term, or_term in zip(subtraction_terms,
                                                      addition_terms, or_terms):
    modifications.append(" ".join(
        list(
            filter(None, (_term_to_str(subtraction_term, operator="-"),
                          _term_to_str(addition_term, operator="+"),
                          _term_to_str(or_term, operator=""))))))

  full_query = f'{escaped_base} {" ".join(modifications)}'
  return full_query.strip()
Modifies a `base`-query with addition and subtraction terms.

  Args:
    base:  Base query, as is, i.e. without manual escaping nor operators.
    addition_terms:  Sequence of terms which will be added to `base` with the
      "+" operator.
    subtraction_terms:  Sequence of terms which will be added to `base` with the
      "-" operator.
    or_terms: Sequence of terms which will be added to `base` directly without
      any operator.

  Returns:
    The properly modified base-query which can be issued to lucene.
  
language/search_agents/t5/t5_agent_lib.py