コード例 #1
0
  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());
  }
コード例 #2
0
  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());
  }