Package org.exist.indexing

Examples of org.exist.indexing.IndexWorker


      else {
          final NodeSet nodes = args[0].toNodeSet();
          final DocumentSet docs = nodes.getDocumentSet();
         
          if (this.getArgumentCount() == 3){
            final IndexWorker indexWorker = context.getBroker().getIndexController().getWorkerByIndexName(args[2].itemAt(0).getStringValue());
            //Alternate design
            //IndexWorker indexWorker = context.getBroker().getBrokerPool().getIndexManager().getIndexByName(args[2].itemAt(0).getStringValue()).getWorker();
            if (indexWorker == null)
              {throw new XPathException(this, "Unknown index: " + args[2].itemAt(0).getStringValue());}
            final Map<String, Object> hints = new HashMap<String, Object>();
            if (indexWorker instanceof OrderedValuesIndex)
              {hints.put(OrderedValuesIndex.START_VALUE, args[1]);}
            else
              {logger.warn(indexWorker.getClass().getName() + " isn't an instance of org.exist.indexing.OrderedIndexWorker. Start value '" + args[1] + "' ignored." );}
            final Occurrences[] occur = indexWorker.scanIndex(context, docs, nodes, hints);
            if (occur.length == 0)
              {result= Sequence.EMPTY_SEQUENCE;}
            else
              {result = new IntegerValue(occur[0].getOccurrences());}
          } else {
View Full Code Here


            {result = Sequence.EMPTY_SEQUENCE;}
      else {
          final NodeSet nodes = args[0].toNodeSet();
          final DocumentSet docs = nodes.getDocumentSet();         
          if (this.getArgumentCount() == 3) {
            final IndexWorker indexWorker = context.getBroker().getIndexController().getWorkerByIndexName(args[2].itemAt(0).getStringValue());
            //Alternate design
            //IndexWorker indexWorker = context.getBroker().getBrokerPool().getIndexManager().getIndexByName(args[2].itemAt(0).getStringValue()).getWorker();           
            if (indexWorker == null)
              {throw new XPathException(this, "Unknown index: " + args[2].itemAt(0).getStringValue());}
            final Map<String, Object> hints = new HashMap<String, Object>();
            if (indexWorker instanceof OrderedValuesIndex)
              {hints.put(OrderedValuesIndex.START_VALUE, args[1]);}
            else
              {logger.warn(indexWorker.getClass().getName() + " isn't an instance of org.exist.indexing.OrderedIndexWorker. Start value '" + args[1] + "' ignored." );}
            final Occurrences[] occur = indexWorker.scanIndex(context, docs, nodes, hints);
            if (occur.length == 0)
              {result= Sequence.EMPTY_SEQUENCE;}
            else
              {result = new IntegerValue(occur[0].getDocuments());}
          } else {
View Full Code Here

        if (args[3].hasOne())
            {max = ((IntegerValue) args[3].itemAt(0)).getInt();}
        final Sequence result = new ValueSequence();
        // if we have 5 arguments, query the user-specified index
        if (this.getArgumentCount() == 5) {
          final IndexWorker indexWorker = context.getBroker().getIndexController().getWorkerByIndexName(args[4].itemAt(0).getStringValue());
          //Alternate design
          //IndexWorker indexWorker = context.getBroker().getBrokerPool().getIndexManager().getIndexByName(args[4].itemAt(0).getStringValue()).getWorker();
          if (indexWorker == null)
            {throw new XPathException(this, "Unknown index: " + args[4].itemAt(0).getStringValue());}
          final Map<String, Object> hints = new HashMap<String, Object>();
            if (max != -1)
              {hints.put(IndexWorker.VALUE_COUNT, new IntegerValue(max));}
          if (indexWorker instanceof OrderedValuesIndex)
            {hints.put(OrderedValuesIndex.START_VALUE, args[1].getStringValue());}
          else
            {logger.warn(indexWorker.getClass().getName() + " isn't an instance of org.exist.indexing.OrderedIndexWorker. Start value '" + args[1] + "' ignored." );}
            if (qnames != null) {
                final List<QName> qnameList = new ArrayList<QName>(qnames.getItemCount());
                for (final SequenceIterator i = qnames.iterate(); i.hasNext();) {
                    final QNameValue qv = (QNameValue) i.nextItem();
                    qnameList.add(qv.getQName());
                }
                hints.put(QNamedKeysIndex.QNAMES_KEY, qnameList);
            }
          final Occurrences[] occur = indexWorker.scanIndex(context, docs, nodes, hints);
          //TODO : add an extra argument to pass the END_VALUE ?
          final int len = (max != -1 && occur.length > max ? max : occur.length);
          final Sequence params[] = new Sequence[2];
          ValueSequence data = new ValueSequence();
          for (int j = 0; j < len; j++) {
View Full Code Here

    private void generateWordList() throws XPathException {
    try {
      MutableDocumentSet docs = new DefaultDocumentSet();
            docs = context.getBroker().getAllXMLResources(docs);
            final IndexWorker indexWorker = context.getBroker().getIndexController().getWorkerByIndexName("lucene-index");

            final Map options = new HashMap();
            options.put(OrderedValuesIndex.START_VALUE, "");

            Occurrences[] occurrences =
                    indexWorker.scanIndex(context, docs, null, options);
            List<String> list = new ArrayList<String>();
            for (int i = 0; i < occurrences.length; i++) {
                list.add(occurrences[i].getTerm().toString());
            }
            words = new String[list.size()];
View Full Code Here

TOP

Related Classes of org.exist.indexing.IndexWorker

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.