public void testCurrentSpacePreferred()
{
searchText = "Crazy";
Space otherSpace = Space.TEST2;
rpc.createSpace(otherSpace);
rpc.grantPermission(SpacePermission.VIEW, otherSpace, testUserWithApostrophe);
Page pageInCurrentSpace = new Page(testSpace, "Crazy talk", "");
Page pageInOtherSpace = new Page(otherSpace, "Crazy talk", "");
rpc.createPage(pageInCurrentSpace);
rpc.createPage(pageInOtherSpace);
Calendar cal = Calendar.getInstance();
cal.add(Calendar.YEAR, -1);
rpc.changePageModificationDate(pageInCurrentSpace.getId(), cal.getTime());
rpc.flushIndexQueue();
editor.edit(testPage);
tinyMce.selectEmptyFirstParagraph();
setAndSelectText(searchText);
editorAutocomplete = triggerWithShortcut();
String currentSpaceTitle = getPageResultTitle(pageInCurrentSpace);
String otherSpaceTitle = getPageResultTitle(pageInOtherSpace);
editorAutocomplete.waitForNthResultToContain(0, currentSpaceTitle);
editorAutocomplete.waitForNthResultToContain(1, otherSpaceTitle);
}