Preconditions.checkNotNull(user);
Multimap<WaveId, WaveletId> userWavesViewMap = HashMultimap.create();
BooleanQuery participantQuery = new BooleanQuery();
participantQuery.add(new TermQuery(new Term(WITH.toString(), user.getAddress())), Occur.SHOULD);
SearcherManager searcherManager = nrtManager.getSearcherManager(true);
IndexSearcher indexSearcher = searcherManager.acquire();
try {
TopDocs hints = indexSearcher.search(participantQuery, MAX_WAVES, LMT_ASC_SORT);
for (ScoreDoc hint : hints.scoreDocs) {
Document document = indexSearcher.doc(hint.doc);
WaveId waveId = WaveId.deserialise(document.get(WAVEID.toString()));
WaveletId waveletId = WaveletId.deserialise(document.get(WAVELETID.toString()));
userWavesViewMap.put(waveId, waveletId);
}
} catch (IOException e) {
LOG.log(Level.WARNING, "Search failed: " + user, e);
} finally {
try {
searcherManager.release(indexSearcher);
} catch (IOException e) {
LOG.log(Level.WARNING, "Failed to close searcher. " + user, e);
}
indexSearcher = null;
}