Package net.yacy.kelondro.data.word

Examples of net.yacy.kelondro.data.word.WordReference


            Log.logException(e);
        }
        ReferenceContainer<WordReference> index = search.joined();
       
        Iterator<WordReference> i = index.entries();
        WordReference entry;
        int c = 0;
        Date lm;
        String lms;
        while (i.hasNext() && c < count) {
            entry = i.next();
            lm = new Date(entry.lastModified());
            lms = GenericFormatter.ANSIC_FORMATTER.format(lm);
            prop.put("event_" + c + "_start", lms); // like "Wed May 01 1963 00:00:00 GMT-0600"
            prop.put("event_" + c + "_end", lms); // like "Sat Jun 01 1963 00:00:00 GMT-0600"
            prop.put("event_" + c + "_isDuration", 0); // 0 (only a point) or 1 (period of time)
            prop.putHTML("event_" + c + "_title", "test"); // short title of the event
View Full Code Here


        public void add(ReferenceContainer<WordReference> container) throws RowSpaceExceededException {
            // iterate through the entries in the container and check if the reference is in the repository
            Iterator<WordReference>  i = container.entries();
            List<byte[]> notFoundx = new ArrayList<byte[]>();
            while (i.hasNext()) {
                WordReference e = i.next();
                if (references.containsKey(e.urlhash())) continue;
                if (badReferences.has(e.urlhash())) {
                    notFoundx.add(e.urlhash());
                    continue;
                }
                URIMetadataRow r = segment.urlMetadata().load(e.urlhash());
                if (r == null) {
                    notFoundx.add(e.urlhash());
                    badReferences.put(e.urlhash());
                } else {
                    references.put(e.urlhash(), r);
                }
            }
            // now delete all references that were not found
            for (final byte[] b : notFoundx) container.removeReference(b);
            // finally add the remaining container to the cache
View Full Code Here

        final List<ReferenceContainer<WordReference>>[] partitions = new ArrayList[partitionCount];
        for (int i = 0; i < partitions.length; i++) partitions[i] = new ArrayList<ReferenceContainer<WordReference>>();

        // check all entries and split them to the partitions
        final ReferenceContainer<WordReference>[] partitionBuffer = new ReferenceContainer[partitionCount];
        WordReference re;
        for (final ReferenceContainer<WordReference> container: containers) {
            // init the new partitions
            for (int j = 0; j < partitionBuffer.length; j++) {
                partitionBuffer[j] = new ReferenceContainer<WordReference>(Segment.wordReferenceFactory, container.getTermHash(), container.size() / partitionCount);
            }

            // split the container
            final Iterator<WordReference> i = container.entries();
            while (i.hasNext()) {
                re = i.next();
                if (re == null) continue;
                partitionBuffer[this.seeds.scheme.verticalPosition(re.urlhash())].add(re);
            }

            // add the containers to the result vector
            for (int j = 0; j < partitionBuffer.length; j++) {
                partitions[j].add(partitionBuffer[j]);
View Full Code Here

            Log.logException(e);
        }
        ReferenceContainer<WordReference> index = search.joined();
       
        Iterator<WordReference> i = index.entries();
        WordReference entry;
        int c = 0;
        Date lm;
        String lms;
        while (i.hasNext() && c < count) {
            entry = i.next();
            lm = new Date(entry.lastModified());
            lms = GenericFormatter.ANSIC_FORMATTER.format(lm);
            prop.put("event_" + c + "_start", lms); // like "Wed May 01 1963 00:00:00 GMT-0600"
            prop.put("event_" + c + "_end", lms); // like "Sat Jun 01 1963 00:00:00 GMT-0600"
            prop.put("event_" + c + "_isDuration", 0); // 0 (only a point) or 1 (period of time)
            prop.putHTML("event_" + c + "_title", "test"); // short title of the event
View Full Code Here

         */
        private ReferenceContainer<WordReference> trimContainer(final ReferenceContainer<WordReference> container, final int max) throws RowSpaceExceededException {
            final ReferenceContainer<WordReference> c = new ReferenceContainer<WordReference>(Segment.wordReferenceFactory, container.getTermHash(), max);
            final int part = container.size() / max + 1;
            final Random r = new Random();
            WordReference w;
            final List<byte[]> selected = new ArrayList<byte[]>();
            final Iterator<WordReference>  i = container.entries();
            while ((i.hasNext()) && (c.size() < max)) {
                w = i.next();
                if (r.nextInt(part) == 0) {
                    c.add(w);
                    selected.add(w.urlhash());
                }
            }
            // remove the selected entries from container
            for (final byte[] b : selected) container.removeReference(b);
            // put container back
View Full Code Here

            final ReferenceContainer<WordReference> c = (remaining >= container.size()) ? container : trimContainer(container, remaining);
            // iterate through the entries in the container and check if the reference is in the repository
            final Iterator<WordReference>  i = c.entries();
            final List<byte[]> notFoundx = new ArrayList<byte[]>();
            while (i.hasNext()) {
                final WordReference e = i.next();
                if (this.references.containsKey(e.urlhash())) continue;
                if (this.badReferences.has(e.urlhash())) {
                    notFoundx.add(e.urlhash());
                    continue;
                }
                final URIMetadataRow r = Transmission.this.segment.urlMetadata().load(e.urlhash());
                if (r == null) {
                    notFoundx.add(e.urlhash());
                    this.badReferences.put(e.urlhash());
                } else {
                    this.references.put(e.urlhash(), r);
                }
            }
            // now delete all references that were not found
            for (final byte[] b : notFoundx) c.removeReference(b);
            // finally add the remaining container to the cache
View Full Code Here

        final List<ReferenceContainer<WordReference>>[] partitions = new ArrayList[partitionCount];
        for (int i = 0; i < partitions.length; i++) partitions[i] = new ArrayList<ReferenceContainer<WordReference>>();

        // check all entries and split them to the partitions
        final ReferenceContainer<WordReference>[] partitionBuffer = new ReferenceContainer[partitionCount];
        WordReference re;
        for (final ReferenceContainer<WordReference> container: containers) {
            // init the new partitions
            for (int j = 0; j < partitionBuffer.length; j++) {
                partitionBuffer[j] = new ReferenceContainer<WordReference>(Segment.wordReferenceFactory, container.getTermHash(), container.size() / partitionCount);
            }

            // split the container
            final Iterator<WordReference> i = container.entries();
            while (i.hasNext()) {
                re = i.next();
                if (re == null) continue;
                partitionBuffer[this.seeds.scheme.verticalPosition(re.urlhash())].add(re);
            }

            // add the containers to the result vector
            for (int j = 0; j < partitionBuffer.length; j++) {
                partitions[j].add(partitionBuffer[j]);
View Full Code Here

TOP

Related Classes of net.yacy.kelondro.data.word.WordReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.