Package org.apache.lucene.index

Examples of org.apache.lucene.index.TermFreqVector


      if (!termDocs.next()) {
        return endOfData();
      }

      int doc = termDocs.doc();
      TermFreqVector termFreqVector = indexReader.getTermFreqVector(doc, field);
      if (termFreqVector == null) {
        numErrorDocs++;
        if (numErrorDocs >= maxErrorDocs) {
          log.error("There are too many documents that do not have a term vector for {}", field);
          throw new IllegalStateException("There are too many documents that do not have a term vector for " + field);
View Full Code Here


     */
    public PriorityQueue retrieveTerms(int docNum) throws IOException {
        Map termFreqMap = new HashMap();
        for (int i = 0; i < fieldNames.length; i++) {
            String fieldName = fieldNames[i];
            TermFreqVector vector = ir.getTermFreqVector(docNum, fieldName);

            // field does not store term vector info
            if (vector == null) {
              Document d=ir.document(docNum);
              String text[]=d.getValues(fieldName);
View Full Code Here

     
      // verify vectors result
      verifyVectors(vectors, docId);
     
      start = System.currentTimeMillis();
      TermFreqVector vector = reader.getTermFreqVector(docId, "field");
      timeElapsed += System.currentTimeMillis()-start;
     
      vectors = new TermFreqVector[1];
      vectors[0] = vector;
     
View Full Code Here

     
      // verify vectors result
      verifyVectors(vectors, docId);
     
      start = System.currentTimeMillis();
      TermFreqVector vector = reader.getTermFreqVector(docId, "field");
      timeElapsed += System.currentTimeMillis()-start;
     
      vectors = new TermFreqVector[1];
      vectors[0] = vector;
     
View Full Code Here

     
      // verify vectors result
      verifyVectors(vectors, docId);
     
      start = System.currentTimeMillis();
      TermFreqVector vector = reader.getTermFreqVector(docId, "field");
      timeElapsed += System.currentTimeMillis()-start;
     
      vectors = new TermFreqVector[1];
      vectors[0] = vector;
     
View Full Code Here

   * @throws IOException
   */
  public FieldTermStack( IndexReader reader, int docId, String fieldName, final FieldQuery fieldQuery ) throws IOException {
    this.fieldName = fieldName;

    TermFreqVector tfv = reader.getTermFreqVector( docId, fieldName );
    if( tfv == null ) return; // just return to make null snippets
    TermPositionVector tpv = null;
    try{
      tpv = (TermPositionVector)tfv;
    }
View Full Code Here

     */
    public PriorityQueue retrieveTerms(int docNum) throws IOException {
        Map termFreqMap = new HashMap();
        for (int i = 0; i < fieldNames.length; i++) {
            String fieldName = fieldNames[i];
            TermFreqVector vector = ir.getTermFreqVector(docNum, fieldName);

            // field does not store term vector info
            if (vector == null) {
              Document d=ir.document(docNum);
              String text[]=d.getValues(fieldName);
View Full Code Here

   * @throws IOException if there was an error loading
   */
  public static TokenStream getAnyTokenStream(IndexReader reader, int docId, String field, Document doc, Analyzer analyzer) throws IOException{
    TokenStream ts=null;

    TermFreqVector tfv=(TermFreqVector) reader.getTermFreqVector(docId,field);
    if(tfv!=null)
    {
        if(tfv instanceof TermPositionVector)
        {
            ts=getTokenStream((TermPositionVector) tfv);
View Full Code Here

     */
    public static TokenStream getAnyTokenStream(IndexReader reader,int docId, String field,Analyzer analyzer) throws IOException
    {
    TokenStream ts=null;

    TermFreqVector tfv=(TermFreqVector) reader.getTermFreqVector(docId,field);
    if(tfv!=null)
    {
        if(tfv instanceof TermPositionVector)
        {
            ts=getTokenStream((TermPositionVector) tfv);
View Full Code Here

        return new StoredTokenStream(tokensInOriginalOrder);
    }

    public static TokenStream getTokenStream(IndexReader reader,int docId, String field) throws IOException
    {
    TermFreqVector tfv=(TermFreqVector) reader.getTermFreqVector(docId,field);
    if(tfv==null)
    {
        throw new IllegalArgumentException(field+" in doc #"+docId
                  +"does not have any term position data stored");
    }
View Full Code Here

TOP

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

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.