@@ -0,0 +1,3034 @@
+package org.apache.lucene.search.vectorhighlight;%0A/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Aimport java.io.IOException;%0A%0Aimport org.apache.lucene.analysis.MockAnalyzer;%0Aimport org.apache.lucene.document.Document;%0Aimport org.apache.lucene.document.Field;%0Aimport org.apache.lucene.document.FieldType;%0Aimport org.apache.lucene.document.TextField;%0Aimport org.apache.lucene.index.DirectoryReader;%0Aimport org.apache.lucene.index.IndexReader;%0Aimport org.apache.lucene.index.IndexWriter;%0Aimport org.apache.lucene.index.Term;%0Aimport org.apache.lucene.search.TermQuery;%0Aimport org.apache.lucene.store.Directory;%0Aimport org.apache.lucene.util.LuceneTestCase;%0A%0A%0Apublic class FastVectorHighlighterTest extends LuceneTestCase %7B%0A  %0A  public void testSimpleHighlightTest() throws IOException %7B%0A    Directory dir = newDirectory();%0A    IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())));%0A    Document doc = new Document();%0A    FieldType type = new FieldType(TextField.TYPE_STORED);%0A    type.setStoreTermVectorOffsets(true);%0A    type.setStoreTermVectorPositions(true);%0A    type.setStoreTermVectors(true);%0A    type.freeze();%0A    Field field = new Field(%22field%22, %22This is a test where foo is highlighed and should be highlighted%22, type);%0A    %0A    doc.add(field);%0A    writer.addDocument(doc);%0A    FastVectorHighlighter highlighter = new FastVectorHighlighter();%0A    %0A    IndexReader reader = DirectoryReader.open(writer, true);%0A    int docId = 0;%0A    FieldQuery fieldQuery  = highlighter.getFieldQuery( new TermQuery(new Term(%22field%22, %22foo%22)), reader );%0A    String%5B%5D bestFragments = highlighter.getBestFragments(fieldQuery, reader, docId, %22field%22, 54, 1);%0A    // highlighted results are centered %0A    assertEquals(%22This is a test where %3Cb%3Efoo%3C/b%3E is highlighed and should be highlighted%22, bestFragments%5B0%5D);%0A    bestFragments = highlighter.getBestFragments(fieldQuery, reader, docId, %22field%22, 52, 1);%0A    assertEquals(%22This is a test where %3Cb%3Efoo%3C/b%3E is highlighed and should be%22, bestFragments%5B0%5D);%0A    bestFragments = highlighter.getBestFragments(fieldQuery, reader, docId, %22field%22, 30, 1);%0A    assertEquals(%22a test where %3Cb%3Efoo%3C/b%3E is highlighed%22, bestFragments%5B0%5D);%0A    reader.close();%0A    writer.close();%0A    dir.close();%0A  %7D%0A%7D%0A

add simple FVH test