Examples of AdaptingHits


Examples of org.apache.jackrabbit.core.query.lucene.hits.AdaptingHits

        /**
         * {@inheritDoc}
         */
        public Hits getHits() throws IOException {
            long time = System.currentTimeMillis();
            Hits childrenHits = new AdaptingHits();
            Hits nameHits = new ScorerHits(nameTestScorer);
            int[] docs = new int[1];
            for (int h = nameHits.next(); h > -1; h = nameHits.next()) {
                docs = hResolver.getParents(h, docs);
                if (docs.length == 1) {
                    // optimize single value
                    if (docIds.contains(docs[0])) {
                        childrenHits.set(h);
                    }
                } else {
                    for (int i = 0; i < docs.length; i++) {
                        if (docIds.contains(docs[i])) {
                            childrenHits.set(h);
                        }
                    }
                }
            }
            time = System.currentTimeMillis() - time;
View Full Code Here

Examples of org.apache.jackrabbit.core.query.lucene.hits.AdaptingHits

                String uuid = reader.document(i, FieldSelectors.UUID).get(FieldNames.UUID);
                uuids.put(i, uuid);
            }

            // get child node entries for each hit
            Hits childrenHits = new AdaptingHits();
            for (String uuid : uuids.values()) {
                NodeId id = new NodeId(uuid);
                try {
                    long time = System.currentTimeMillis();
                    NodeState state = (NodeState) itemMgr.getItemState(id);
                    time = System.currentTimeMillis() - time;
                    log.debug("got NodeState with id {} in {} ms.", id, time);
                    List<ChildNodeEntry> entries;
                    if (nameTest != null) {
                        entries = state.getChildNodeEntries(nameTest);
                    } else {
                        // get all children
                        entries = state.getChildNodeEntries();
                    }
                    for (ChildNodeEntry entry : entries) {
                        NodeId childId = entry.getId();
                        Term uuidTerm = new Term(FieldNames.UUID, childId.toString());
                        TermDocs docs = reader.termDocs(uuidTerm);
                        try {
                            if (docs.next()) {
                                childrenHits.set(docs.doc());
                            }
                        } finally {
                            docs.close();
                        }
                    }
View Full Code Here

Examples of org.apache.jackrabbit.core.query.lucene.hits.AdaptingHits

        /**
         * {@inheritDoc}
         */
        public Hits getHits() throws IOException {
            long time = System.currentTimeMillis();
            Hits childrenHits = new AdaptingHits();
            Hits nameHits = new ScorerHits(nameTestScorer);
            int[] docs = new int[1];
            for (int h = nameHits.next(); h > -1; h = nameHits.next()) {
                docs = hResolver.getParents(h, docs);
                if (docs.length == 1) {
                    // optimize single value
                    if (docIds.contains(docs[0])) {
                        childrenHits.set(h);
                    }
                } else {
                    for (int i = 0; i < docs.length; i++) {
                        if (docIds.contains(docs[i])) {
                            childrenHits.set(h);
                        }
                    }
                }
            }
            time = System.currentTimeMillis() - time;
View Full Code Here

Examples of org.apache.jackrabbit.core.query.lucene.hits.AdaptingHits

        private void calculateChildren() throws IOException {
            if (hits == null) {
               
                // collect all context nodes
                List uuids = new ArrayList();
                final Hits contextHits = new AdaptingHits();
                contextScorer.score(new HitCollector() {
                    public void collect(int doc, float score) {
                        contextHits.set(doc);
                    }
                });

                // read the uuids of the context nodes
                int i = contextHits.next();
                while (i > -1) {
                    String uuid = reader.document(i).get(FieldNames.UUID);
                    uuids.add(uuid);
                    i = contextHits.next();
                }
               
                // collect all children of the context nodes
                Hits childrenHits = new AdaptingHits();

                TermDocs docs = reader.termDocs();
                try {
                    for (Iterator it = uuids.iterator(); it.hasNext();) {
                        docs.seek(new Term(FieldNames.PARENT, (String) it.next()));
                        while (docs.next()) {
                            childrenHits.set(docs.doc());
                        }
                    }
                } finally {
                    docs.close();
                }
View Full Code Here

Examples of org.apache.jackrabbit.core.query.lucene.hits.AdaptingHits

                String uuid = reader.document(i, FieldSelectors.UUID).get(FieldNames.UUID);
                uuids.put(new Integer(i), uuid);
            }

            // get child node entries for each hit
            Hits childrenHits = new AdaptingHits();
            for (Iterator it = uuids.values().iterator(); it.hasNext(); ) {
                String uuid = (String) it.next();
                NodeId id = new NodeId(UUID.fromString(uuid));
                try {
                    long time = System.currentTimeMillis();
                    NodeState state = (NodeState) itemMgr.getItemState(id);
                    time = System.currentTimeMillis() - time;
                    log.debug("got NodeState with id {} in {} ms.", id, new Long(time));
                    Iterator entries;
                    if (nameTest != null) {
                        entries = state.getChildNodeEntries(nameTest).iterator();
                    } else {
                        // get all children
                        entries = state.getChildNodeEntries().iterator();
                    }
                    while (entries.hasNext()) {
                        NodeId childId = ((NodeState.ChildNodeEntry) entries.next()).getId();
                        Term uuidTerm = new Term(FieldNames.UUID, childId.getUUID().toString());
                        TermDocs docs = reader.termDocs(uuidTerm);
                        try {
                            if (docs.next()) {
                                childrenHits.set(docs.doc());
                            }
                        } finally {
                            docs.close();
                        }
                    }
View Full Code Here

Examples of org.apache.jackrabbit.core.query.lucene.hits.AdaptingHits

        /**
         * {@inheritDoc}
         */
        public Hits getHits() throws IOException {
            long time = System.currentTimeMillis();
            Hits childrenHits = new AdaptingHits();
            Hits nameHits = new ScorerHits(nameTestScorer);
            for (int h = nameHits.next(); h > -1; h = nameHits.next()) {
                if (docIds.contains(new Integer(hResolver.getParent(h)))) {
                    childrenHits.set(h);
                }
            }
            time = System.currentTimeMillis() - time;

            log.debug("Filtered hits in {} ms.", new Long(time));
View Full Code Here

Examples of org.apache.jackrabbit.core.query.lucene.hits.AdaptingHits

                String uuid = reader.document(i, FieldSelectors.UUID).get(FieldNames.UUID);
                uuids.put(i, uuid);
            }

            // get child node entries for each hit
            Hits childrenHits = new AdaptingHits();
            for (String uuid : uuids.values()) {
                NodeId id = new NodeId(uuid);
                try {
                    long time = System.currentTimeMillis();
                    NodeState state = (NodeState) itemMgr.getItemState(id);
                    time = System.currentTimeMillis() - time;
                    log.debug("got NodeState with id {} in {} ms.", id, time);
                    List<ChildNodeEntry> entries;
                    if (nameTest != null) {
                        entries = state.getChildNodeEntries(nameTest);
                    } else {
                        // get all children
                        entries = state.getChildNodeEntries();
                    }
                    for (ChildNodeEntry entry : entries) {
                        NodeId childId = entry.getId();
                        Term uuidTerm = TermFactory.createUUIDTerm(childId.toString());
                        TermDocs docs = reader.termDocs(uuidTerm);
                        try {
                            if (docs.next()) {
                                childrenHits.set(docs.doc());
                            }
                        } finally {
                            docs.close();
                        }
                    }
View Full Code Here

Examples of org.apache.jackrabbit.core.query.lucene.hits.AdaptingHits

        /**
         * {@inheritDoc}
         */
        public Hits getHits() throws IOException {
            long time = System.currentTimeMillis();
            Hits childrenHits = new AdaptingHits();
            Hits nameHits = new ScorerHits(nameTestScorer);
            int[] docs = new int[1];
            for (int h = nameHits.next(); h > -1; h = nameHits.next()) {
                docs = hResolver.getParents(h, docs);
                if (docs.length == 1) {
                    // optimize single value
                    if (docIds.contains(docs[0])) {
                        childrenHits.set(h);
                    }
                } else {
                    for (int i = 0; i < docs.length; i++) {
                        if (docIds.contains(docs[i])) {
                            childrenHits.set(h);
                        }
                    }
                }
            }
            time = System.currentTimeMillis() - time;
View Full Code Here

Examples of org.apache.jackrabbit.core.query.lucene.hits.AdaptingHits

                String uuid = reader.document(i, FieldSelectors.UUID).get(FieldNames.UUID);
                uuids.put(new Integer(i), uuid);
            }

            // get child node entries for each hit
            Hits childrenHits = new AdaptingHits();
            for (Iterator it = uuids.values().iterator(); it.hasNext(); ) {
                String uuid = (String) it.next();
                NodeId id = new NodeId(UUID.fromString(uuid));
                try {
                    long time = System.currentTimeMillis();
                    NodeState state = (NodeState) itemMgr.getItemState(id);
                    time = System.currentTimeMillis() - time;
                    log.debug("got NodeState with id {} in {} ms.", id, new Long(time));
                    Iterator entries;
                    if (nameTest != null) {
                        entries = state.getChildNodeEntries(nameTest).iterator();
                    } else {
                        // get all children
                        entries = state.getChildNodeEntries().iterator();
                    }
                    while (entries.hasNext()) {
                        NodeId childId = ((ChildNodeEntry) entries.next()).getId();
                        Term uuidTerm = new Term(FieldNames.UUID, childId.getUUID().toString());
                        TermDocs docs = reader.termDocs(uuidTerm);
                        try {
                            if (docs.next()) {
                                childrenHits.set(docs.doc());
                            }
                        } finally {
                            docs.close();
                        }
                    }
View Full Code Here

Examples of org.apache.jackrabbit.core.query.lucene.hits.AdaptingHits

        /**
         * {@inheritDoc}
         */
        public Hits getHits() throws IOException {
            long time = System.currentTimeMillis();
            Hits childrenHits = new AdaptingHits();
            Hits nameHits = new ScorerHits(nameTestScorer);
            int[] docs = new int[1];
            for (int h = nameHits.next(); h > -1; h = nameHits.next()) {
                docs = hResolver.getParents(h, docs);
                if (docs.length == 1) {
                    // optimize single value
                    if (docIds.contains(new Integer(docs[0]))) {
                        childrenHits.set(h);
                    }
                } else {
                    for (int i = 0; i < docs.length; i++) {
                        if (docIds.contains(new Integer(docs[i]))) {
                            childrenHits.set(h);
                        }
                    }
                }
            }
            time = System.currentTimeMillis() - time;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.