Examples of TermPositionVector


Examples of org.apache.lucene.index.TermPositionVector

      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

Examples of org.apache.lucene.index.TermPositionVector

      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

Examples of org.apache.lucene.index.TermPositionVector

        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

Examples of org.apache.lucene.index.TermPositionVector

            ts.close();
        } 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

Examples of org.apache.lucene.index.TermPositionVector

            }
        } 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

Examples of org.apache.lucene.index.TermPositionVector

      /**
       * Since there are so many combinations of results here, we are only going
       * to assert a few. - J.G.
       */
      int x = 0;
      TermPositionVector vector = (TermPositionVector) reader.getTermFreqVector(x, "content");
      assertNotNull(vector);
      String[] terms = vector.getTerms();
      int[] freqs = vector.getTermFrequencies();

      assertEquals("electrical", terms[x]);
      assertEquals(2, freqs[x]);

      TermVectorOffsetInfo[] offsets = vector.getOffsets(x);
      assertEquals(0, offsets[x].getStartOffset());
      assertEquals(10, offsets[x].getEndOffset());

      int[] termPositions = vector.getTermPositions(0);
      assertEquals(0, termPositions[0]);
      assertEquals(3, termPositions[1]);

      //cleanup
      for (Object element : s.createQuery("from " + Employee.class.getName()).list()) s.delete(element);
View Full Code Here

Examples of org.apache.lucene.index.TermPositionVector

      SearchFactory searchFactory = s.getSearchFactory();
      DirectoryProvider provider = searchFactory.getDirectoryProviders(Employee.class)[0];
      ReaderProvider readerProvider = searchFactory.getReaderProvider();
      IndexReader reader = readerProvider.openReader(provider);

      TermPositionVector vector = (TermPositionVector) reader.getTermFreqVector(0, "dept");
      assertNull("should not find a term position vector", vector);

      //cleanup
      for (Object element : s.createQuery("from " + ElectricalProperties.class.getName()).list())
         s.delete(element);
View Full Code Here

Examples of org.apache.lucene.index.TermPositionVector

            }
        } 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

Examples of org.apache.lucene.index.TermPositionVector

            }
        } 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

Examples of org.apache.lucene.index.TermPositionVector

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

      return new TermPositionVector()
      {

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

         public int[] getTermPositions(int index)
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.