@Test
public void testDoQueryString() {

    // build a query
    String querystr = "foo";
    try {
        Query q = new QueryParser("name", analyzer).parse(querystr);
        Collection<String> results = searchService.doQuery(q, new SingleFieldStringMapper("name"));
        assertEquals("Wrong number of results", 4, results.size());
        assertTrue(results.contains("foo"));
        assertTrue(results.contains("foo bar"));
        assertTrue(results.contains("foo bar baz"));
        assertTrue(results.contains("foo baz"));
        q = new QueryParser("uri", analyzer).parse(querystr);
        results = searchService.doQuery(q, new SingleFieldStringMapper("uri"));
        assertEquals("Wrong number of results", 4, results.size());
        assertTrue(results.contains(convertToURI("foo").toString()));
        assertTrue(results.contains(convertToURI("foo bar").toString()));
        assertTrue(results.contains(convertToURI("foo bar baz").toString()));
        assertTrue(results.contains(convertToURI("foo baz").toString()));
    }
    catch (ParseException e) {
        e.printStackTrace();
        fail();
    }
    catch (IOException e) {
        e.printStackTrace();
        fail();
    }
}