private Path dumpSearchResults(User user, Request request) throws ParseException, IOException, FileNotFoundException { user = userService.validate(user); Query query = searchService.getQuery(request); IndexSearcher searcher = getSearcher(request, user); Filter f = NumericRangeFilter.newLongRange( MailSchemaField.date.name(), request.startTime, request.endTime, true, true); TopDocs docs = searcher.search(query, f, request.scanSize); Path tempFile = Files.createTempFile(format("kw-%s-%s", user.id, request.keywordField), ".mailytics.temp"); PrintWriter writer = new PrintWriter(tempFile.toFile()); TIntHashSet dupSet = new TIntHashSet(); for (ScoreDoc sd : docs.scoreDocs) { Document doc = searcher.doc(sd.doc); String string = doc.get(request.keywordField.name()); int hash = string.hashCode(); if (!dupSet.contains(hash)) { writer.println(string); dupSet.add(hash); } } dupSet.clear(); writer.close(); return tempFile; }
public void clear() { set.clear(); }
/** Resets the current connections in preparation for new permanence adjustments. */ public void resetConnections() { synapseConnections.clear(); }