Package org.exist.util

Examples of org.exist.util.ValueOccurrences


            occurrences = broker.getValueIndex().scanIndexKeys(docs, null, term);
        else
            occurrences = broker.getValueIndex().scanIndexKeys(docs, null, new QName[] { qname }, term);
        int found = 0;
        for (int i = 0; i < occurrences.length; i++) {
            ValueOccurrences occurrence = occurrences[i];
            System.out.println("Found: " + occurrence.getValue());
            if (occurrence.getValue().compareTo(term) == 0)
                found++;
        }
        assertEquals(count, found);
    }
View Full Code Here


            if (occur.length == 0)
              {result= Sequence.EMPTY_SEQUENCE;}
            else
              {result = new IntegerValue(occur[0].getOccurrences());}
          } else {
            ValueOccurrences occur[] = context.getBroker().getValueIndex().scanIndexKeys(docs, nodes, (Indexable) (args[1].itemAt(0)));
            if (occur.length == 0)
              {occur = context.getBroker().getValueIndex().scanIndexKeys(docs, nodes, null, (Indexable) (args[1].itemAt(0)));}
            if (occur.length == 0)
                    {result = Sequence.EMPTY_SEQUENCE;}
                else
View Full Code Here

            if (occur.length == 0)
              {result= Sequence.EMPTY_SEQUENCE;}
            else
              {result = new IntegerValue(occur[0].getDocuments());}
          } else {
            final ValueOccurrences occur[] = context.getBroker().getValueIndex()
                .scanIndexKeys(docs, nodes, (Indexable) args[1]);
            if (occur.length == 0)
              {result= Sequence.EMPTY_SEQUENCE;}
            else
              {result = new IntegerValue(occur[0].getDocuments());}         
View Full Code Here

              data.clear();
          }
      // no index specified: use the range index
        } else {
            final Indexable indexable = (Indexable) args[1].itemAt(0);
            ValueOccurrences occur[] = null;
            // First check for indexes defined on qname
            final QName[] allQNames = getDefinedIndexes(context.getBroker(), docs);
            if (allQNames.length > 0)
                {occur = context.getBroker().getValueIndex().scanIndexKeys(docs, nodes, allQNames, indexable);}
            // Also check if there's an index defined by path
            ValueOccurrences occur2[] = context.getBroker().getValueIndex().scanIndexKeys(docs, nodes, indexable);
            // Merge the two results
            if (occur == null || occur.length == 0)
                {occur = occur2;}
            else {
                ValueOccurrences t[] = new ValueOccurrences[occur.length + occur2.length];
                System.arraycopy(occur, 0, t, 0, occur.length);
                System.arraycopy(occur2, 0, t, occur.length, occur2.length);
                occur = t;
            }
View Full Code Here

            catch( final IOException e ) {
                LOG.error( e.getMessage(), e );
                return( true );
            }

            ValueOccurrences oc = map.get( atomic );

            try {

                while( is.available() > 0 ) {
                    boolean      docAdded       = false;
                    final int          storedDocId    = is.readInt();
                    final int          gidsCount      = is.readInt();
                    final int          size           = is.readFixedInt();
                    final DocumentImpl storedDocument = docs.getDoc( storedDocId );

                    //Exit if the document is not concerned
                    if( storedDocument == null ) {
                        is.skipBytes( size );
                        continue;
                    }
                    NodeId    lastParentId = null;
                    NodeId    previous     = null;
                    NodeId    nodeId;
                    NodeProxy parentNode;

                    for( int j = 0; j < gidsCount; j++ ) {
                        nodeId   = broker.getBrokerPool().getNodeFactory().createFromStream( previous, is );
                        previous = nodeId;

                        if( contextSet != null ) {
                          parentNode = contextSet.get(storedDocument, nodeId);
//                            parentNode = contextSet.parentWithChild( storedDocument, nodeId, false, true );
                        } else {
                            parentNode = new NodeProxy( storedDocument, nodeId );
                        }

                        if( parentNode != null ) {

                            if( oc == null ) {
                                oc = new ValueOccurrences( atomic );
                                map.put( atomic, oc );
                            }

                            //Handle this very special case : /item[foo = "bar"] vs. /item[@foo = "bar"]
                            //Same value, same parent but different nodes !
                            //Not sure if we should track the contextSet's parentId... (just like we do)
                            //... or the way the contextSet is created (thus keeping track of the NodeTest)
                            if( ( lastParentId == null ) || !lastParentId.equals( parentNode.getNodeId() ) ) {
                                oc.addOccurrences( 1 );
                            }

                            if( !docAdded ) {
                                oc.addDocument( storedDocument );
                                docAdded = true;
                            }
                            lastParentId = parentNode.getNodeId();
                        }
                        //TODO : what if contextSet == null ? -pb
View Full Code Here

TOP

Related Classes of org.exist.util.ValueOccurrences

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.