private void _runSearch(
      final String query,
      final QueryType type,
      final User searcher,
      final int numberOfIssues,
      final String resolutionId)
      throws SearchException {
    final LuceneSearchProvider luceneSearchProvider = getSearchProvider();

    // Create a search request
    final JqlClauseBuilder jqlQuery =
        JqlQueryBuilder.newBuilder().where().defaultAnd().resolution(resolutionId);

    switch (type) {
      case COMMENT:
        jqlQuery.comment(query);
        break;
      case ISSUE:
        jqlQuery.summary(query);
        break;
    }
    final SearchResults issues =
        luceneSearchProvider.search(jqlQuery.buildQuery(), searcher, new PagerFilter(-1));
    assertNotNull(issues);
    assertEquals(query, numberOfIssues, issues.getTotal());
  }
  public void testNullQuery() throws SearchException {
    final LuceneSearchProvider luceneSearchProvider = getSearchProvider();

    // Create a search request
    final SearchResults issues = luceneSearchProvider.search(null, bob, new PagerFilter(-1));
    assertNotNull(issues);
    assertEquals(0, issues.getTotal());
  }
  public void testStandardQuery() throws SearchException {
    final LuceneSearchProvider luceneSearchProvider = getSearchProvider();

    // Create a search request
    final QueryImpl query =
        new QueryImpl(
            new TerminalClauseImpl(
                "resolution", Operator.EQUALS, new SingleValueOperand(resolutionId)));

    final SearchResults issues = luceneSearchProvider.search(query, bob, new PagerFilter(-1));
    assertNotNull(issues);
    assertEquals(3, issues.getTotal());
  }
  public void testComplexQueryWithSummaryAndComments() throws SearchException {
    final LuceneSearchProvider luceneSearchProvider = getSearchProvider();

    // Create a search request
    JqlClauseBuilder jqlQuery =
        JqlQueryBuilder.newBuilder()
            .where()
            .resolution(resolutionId)
            .and()
            .sub()
            .comment(SUMMARY_BODY)
            .or()
            .summary(SUMMARY_BODY)
            .endsub();

    final SearchResults issues =
        luceneSearchProvider.search(jqlQuery.buildQuery(), bob, new PagerFilter(-1));
    assertNotNull(issues);
    assertEquals(2, issues.getTotal());
  }