Package org.apache.lucene.index

Examples of org.apache.lucene.index.TermPositionVector


      if (document == null) {
        continue; // deleted
      }
      for (Fieldable field : document.getDocument().getFields()) {
        if (field.isTermVectorStored() && field.isStoreOffsetWithTermVector()) {
          TermPositionVector termPositionVector = (TermPositionVector) sourceIndexReader.getTermFreqVector(document.getDocumentNumber(), field.name());
          if (termPositionVector != null) {
            for (int i = 0; i < termPositionVector.getTerms().length; i++) {
              String token = termPositionVector.getTerms()[i];
              InstantiatedTerm term = findTerm(field.name(), token);
              InstantiatedTermDocumentInformation termDocumentInformation = term.getAssociatedDocument(document.getDocumentNumber());
              termDocumentInformation.setTermOffsets(termPositionVector.getOffsets(i));
            }
          }
        }
      }
    }
View Full Code Here


        throw new IllegalArgumentException(field+" in doc #"+docId
                  +"does not have any term position data stored");
    }
      if(tfv instanceof TermPositionVector)
      {
      TermPositionVector tpv=(TermPositionVector) reader.getTermFreqVector(docId,field);
          return getTokenStream(tpv);         
      }
      throw new IllegalArgumentException(field+" in doc #"+docId
              +"does not have any term position data stored");
    }
View Full Code Here

      if (DEBUG) System.err.println("MemoryIndexReader.getTermFreqVector");
      final Info info = getInfo(fieldName);
      if (info == null) return null; // TODO: or return empty vector impl???
      info.sortTerms();
     
      return new TermPositionVector() {
 
        private final Map.Entry<String,ArrayIntList>[] sortedTerms = info.sortedTerms;
       
        public String getField() {
          return fieldName;
View Full Code Here

        throw new IllegalArgumentException(field+" in doc #"+docId
                  +"does not have any term position data stored");
    }
      if(tfv instanceof TermPositionVector)
      {
      TermPositionVector tpv=(TermPositionVector) reader.getTermFreqVector(docId,field);
          return getTokenStream(tpv);         
      }
      throw new IllegalArgumentException(field+" in doc #"+docId
              +"does not have any term position data stored");
    }
View Full Code Here

      if (document == null) {
        continue; // deleted
      }
      for (Field field : (List<Field>) document.getDocument().getFields()) {
        if (field.isTermVectorStored() && field.isStoreOffsetWithTermVector()) {
          TermPositionVector termPositionVector = (TermPositionVector) sourceIndexReader.getTermFreqVector(document.getDocumentNumber(), field.name());
          if (termPositionVector != null) {
            for (int i = 0; i < termPositionVector.getTerms().length; i++) {
              String token = termPositionVector.getTerms()[i];
              InstantiatedTerm term = findTerm(field.name(), token);
              InstantiatedTermDocumentInformation termDocumentInformation = term.getAssociatedDocument(document.getDocumentNumber());
              termDocumentInformation.setTermOffsets(termPositionVector.getOffsets(i));
            }
          }
        }
      }
    }
View Full Code Here

      if (DEBUG) System.err.println("MemoryIndexReader.getTermFreqVector");
      final Info info = getInfo(fieldName);
      if (info == null) return null; // TODO: or return empty vector impl???
      info.sortTerms();
     
      return new TermPositionVector() {
 
        private final Map.Entry[] sortedTerms = info.sortedTerms;
       
        public String getField() {
          return fieldName;
View Full Code Here

      if (DEBUG) System.err.println("MemoryIndexReader.getTermFreqVector");
      final Info info = getInfo(fieldName);
      if (info == null) return null; // TODO: or return empty vector impl???
      info.sortTerms();
     
      return new TermPositionVector() {
 
        private final Map.Entry<String,ArrayIntList>[] sortedTerms = info.sortedTerms;
       
        public String getField() {
          return fieldName;
View Full Code Here

         {
            LOG.trace("An exception occurred: " + e.getMessage());
         }
      }

      return new TermPositionVector()
      {

         private String[] terms = (String[])termMap.keySet().toArray(new String[termMap.size()]);

         public int[] getTermPositions(int index)
View Full Code Here

            }
        } catch (IOException e) {
            // should never happen, we are reading from a string
        }

        return new TermPositionVector() {

            private String[] terms =
                    (String[]) termMap.keySet().toArray(new String[termMap.size()]);

            public int[] getTermPositions(int index) {
View Full Code Here

            }
        } catch (IOException e) {
            // should never happen, we are reading from a string
        }

        return new TermPositionVector() {

            private String[] terms =
                    (String[]) termMap.keySet().toArray(new String[termMap.size()]);

            public int[] getTermPositions(int index) {
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.TermPositionVector

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.