Package org.apache.lucene.index

Examples of org.apache.lucene.index.TermFreqVector


  }

  @Override
  public TermFreqVector getTermFreqVector(int docNum, String field) throws IOException {

    TermFreqVector termVector = null;
    try {
      termVector = new org.solbase.lucenehbase.TermFreqVector(field, docNum);
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    }
View Full Code Here


                        }
                    }
                }
                separator = " ";
            }
            TermFreqVector tfv = reader.getTermFreqVector(
                    docNumber, FieldNames.FULLTEXT);
            if (tfv instanceof TermPositionVector) {
                return createExcerpt((TermPositionVector) tfv, text.toString(),
                        maxFragments, maxFragmentSize);
            } else {
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 = 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 = 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 = 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

    @Override
    public int contextTermsNumber(DBpediaResource resource) throws SearchException {
        int termsCount = 0;
        for (ScoreDoc hit : mMergedSearcher.getHits(resource)) {
            TermFreqVector vector = mMergedSearcher.getVector(hit.doc);
            termsCount += vector.getTerms().length;
        }
        return termsCount;
    }
View Full Code Here

  @Override
  protected Vector computeNext() {
    try {
      int doc;
      TermFreqVector termFreqVector;

      do {
        if (!termDocs.next()) {
          return endOfData();
        }
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

   */
  public PriorityQueue<Object[]> retrieveTerms(int docNum) throws IOException {
    Map<String,Int> termFreqMap = new HashMap<String,Int>();
    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

                  }
               }
            }
            separator = " ";
         }
         TermFreqVector tfv = reader.getTermFreqVector(docNumber, FieldNames.FULLTEXT);
         if (tfv instanceof TermPositionVector)
         {
            return createExcerpt((TermPositionVector)tfv, text.toString(), maxFragments, maxFragmentSize);
         }
         else
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.