@Override public ReferenceContainer<ReferenceType> reduce( final ReferenceContainer<ReferenceType> container) { container.sort(); container.removeEntries(this.urlHashes); return container; }
/** * all containers in the BLOBs and the RAM are merged and returned. Please be aware that the * returned values may be top-level cloned ReferenceContainers or direct links to containers If * the containers are modified after they are returned, they MAY alter the stored index. * * @throws IOException * @return a container with merged ReferenceContainer from RAM and the file array or null if there * is no data to be returned */ @Override public ReferenceContainer<ReferenceType> get(final byte[] termHash, final HandleSet urlselection) throws IOException { final ReferenceContainer<ReferenceType> c0 = this.ram.get(termHash, null); ReferenceContainer<ReferenceType> c1 = null; try { c1 = this.array.get(termHash); } catch (final SpaceExceededException e2) { ConcurrentLog.logException(e2); } ReferenceContainer<ReferenceType> result = null; if (c0 != null && c1 != null) { try { result = c1.merge(c0); } catch (final SpaceExceededException e) { // try to free some ram try { result = c1.merge(c0); } catch (final SpaceExceededException e1) { // go silently over the problem result = (c1.size() > c0.size()) ? c1 : c0; } } } else if (c0 != null) { result = c0; } else if (c1 != null) { result = c1; } if (result == null) return null; // remove the failed urls synchronized (this.removeDelayedURLs) { final HandleSet s = this.removeDelayedURLs.get(termHash); if (s != null) result.removeEntries(s); } return result; }