mirror of https://github.com/apache/lucene.git
Make test use term vectors instead of indexing since Lucene 3.x supported offsets in term vectors but not in the index.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1538686 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c47050e211
commit
7b9e044b06
|
@ -1,5 +1,22 @@
|
|||
package org.apache.lucene.analysis;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.util.Arrays;
|
||||
|
@ -24,23 +41,6 @@ import org.apache.lucene.util.automaton.BasicOperations;
|
|||
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
|
||||
import org.apache.lucene.util.automaton.RegExp;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
public class TestMockAnalyzer extends BaseTokenStreamTestCase {
|
||||
|
||||
/** Test a configuration that behaves a lot like WhitespaceAnalyzer */
|
||||
|
@ -312,13 +312,16 @@ public class TestMockAnalyzer extends BaseTokenStreamTestCase {
|
|||
final Document doc = new Document();
|
||||
final FieldType ft = new FieldType();
|
||||
ft.setIndexed(true);
|
||||
ft.setIndexOptions(IndexOptions.DOCS_ONLY);
|
||||
ft.setTokenized(true);
|
||||
ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
|
||||
ft.setStoreTermVectors(true);
|
||||
ft.setStoreTermVectorPositions(true);
|
||||
ft.setStoreTermVectorOffsets(true);
|
||||
doc.add(new Field("f", "a", ft));
|
||||
doc.add(new Field("f", "a", ft));
|
||||
writer.addDocument(doc, a);
|
||||
final AtomicReader reader = getOnlySegmentReader(writer.getReader());
|
||||
final Fields fields = reader.fields();
|
||||
final Fields fields = reader.getTermVectors(0);
|
||||
final Terms terms = fields.terms("f");
|
||||
final TermsEnum te = terms.iterator(null);
|
||||
assertEquals(new BytesRef("a"), te.next());
|
||||
|
|
Loading…
Reference in New Issue