query.setQuery("cafe");
query.setRequestHandler("keyword");
query.setIncludeScore(true);
// should match the two documents, with same score
QueryResponse response = getWrapper().getServer().query(query);
SolrDocumentList docList = response.getResults();
assertEquals(2, docList.getNumFound());
float score1 = (Float) docList.get(0).getFieldValue("score");
float score2 = (Float) docList.get(1).getFieldValue("score");
Assert.assertTrue("Score should be identical", score1 == score2);
// should match the two documents, but should assign different score
// id2 should receive better score than id1
query = new SolrQuery();
query.setQuery("café");
query.setRequestHandler("keyword");
query.setIncludeScore(true);
response = getWrapper().getServer().query(query);
docList = response.getResults();
assertEquals(2, docList.getNumFound());
if (docList.get(0).getFieldValue("url").equals("id1")) {
score1 = (Float) docList.get(0).getFieldValue("score");
score2 = (Float) docList.get(1).getFieldValue("score");
}