mirror of https://github.com/apache/lucene.git
LUCENE-4449: commit current state to calm jenkins
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1391835 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
40d5e3de67
commit
57c572dc86
|
@ -0,0 +1,34 @@
|
||||||
|
package org.apache.lucene.codecs.appending;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 org.apache.lucene.codecs.Codec;
|
||||||
|
import org.apache.lucene.codecs.lucene40.Lucene40Codec;
|
||||||
|
import org.apache.lucene.index.BasePostingsFormatTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests AppendingPostingsFormat
|
||||||
|
*/
|
||||||
|
public class TestAppendingPostingsFormat extends BasePostingsFormatTestCase {
|
||||||
|
private final Codec codec = new AppendingCodec();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Codec getCodec() {
|
||||||
|
return codec;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package org.apache.lucene.codecs.block;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 org.apache.lucene.codecs.Codec;
|
||||||
|
import org.apache.lucene.codecs.PostingsFormat;
|
||||||
|
import org.apache.lucene.codecs.appending.AppendingCodec;
|
||||||
|
import org.apache.lucene.codecs.block.BlockPostingsFormat;
|
||||||
|
import org.apache.lucene.codecs.lucene40.Lucene40Codec;
|
||||||
|
import org.apache.lucene.index.BasePostingsFormatTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests BlockPostingsFormat
|
||||||
|
*/
|
||||||
|
public class TestBlockPostingsFormat extends BasePostingsFormatTestCase {
|
||||||
|
private final PostingsFormat postings = new BlockPostingsFormat();
|
||||||
|
private final Codec codec = new Lucene40Codec() {
|
||||||
|
@Override
|
||||||
|
public PostingsFormat getPostingsFormatForField(String field) {
|
||||||
|
return postings;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Codec getCodec() {
|
||||||
|
return codec;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package org.apache.lucene.codecs.blockterms;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 org.apache.lucene.codecs.Codec;
|
||||||
|
import org.apache.lucene.codecs.PostingsFormat;
|
||||||
|
import org.apache.lucene.codecs.lucene40.Lucene40Codec;
|
||||||
|
import org.apache.lucene.codecs.lucene40ords.Lucene40WithOrds;
|
||||||
|
import org.apache.lucene.index.BasePostingsFormatTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic tests of a PF using FixedGap terms dictionary
|
||||||
|
*/
|
||||||
|
// TODO: we should add an instantiation for VarGap too to TestFramework, and a test in this package
|
||||||
|
// TODO: ensure both of these are also in rotation in RandomCodec
|
||||||
|
public class TestFixedGapPostingsFormat extends BasePostingsFormatTestCase {
|
||||||
|
private final PostingsFormat postings = new Lucene40WithOrds();
|
||||||
|
private final Codec codec = new Lucene40Codec() {
|
||||||
|
@Override
|
||||||
|
public PostingsFormat getPostingsFormatForField(String field) {
|
||||||
|
return postings;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Codec getCodec() {
|
||||||
|
return codec;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package org.apache.lucene.codecs.bloom;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 org.apache.lucene.codecs.Codec;
|
||||||
|
import org.apache.lucene.codecs.PostingsFormat;
|
||||||
|
import org.apache.lucene.codecs.lucene40.Lucene40Codec;
|
||||||
|
import org.apache.lucene.index.BasePostingsFormatTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic tests for BloomPostingsFormat
|
||||||
|
*/
|
||||||
|
public class TestBloomPostingsFormat extends BasePostingsFormatTestCase {
|
||||||
|
private final PostingsFormat postings = new TestBloomFilteredLucene40Postings();
|
||||||
|
private final Codec codec = new Lucene40Codec() {
|
||||||
|
@Override
|
||||||
|
public PostingsFormat getPostingsFormatForField(String field) {
|
||||||
|
return postings;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Codec getCodec() {
|
||||||
|
return codec;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package org.apache.lucene.codecs.intblock;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 org.apache.lucene.codecs.Codec;
|
||||||
|
import org.apache.lucene.codecs.PostingsFormat;
|
||||||
|
import org.apache.lucene.codecs.lucene40.Lucene40Codec;
|
||||||
|
import org.apache.lucene.codecs.mockintblock.MockFixedIntBlockPostingsFormat;
|
||||||
|
import org.apache.lucene.index.BasePostingsFormatTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic tests for FixedIntBlock
|
||||||
|
*/
|
||||||
|
public class TestFixedIntBlockPostingsFormat extends BasePostingsFormatTestCase {
|
||||||
|
// TODO: randomize blocksize
|
||||||
|
private final PostingsFormat postings = new MockFixedIntBlockPostingsFormat();
|
||||||
|
private final Codec codec = new Lucene40Codec() {
|
||||||
|
@Override
|
||||||
|
public PostingsFormat getPostingsFormatForField(String field) {
|
||||||
|
return postings;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Codec getCodec() {
|
||||||
|
return codec;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package org.apache.lucene.codecs.intblock;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 org.apache.lucene.codecs.Codec;
|
||||||
|
import org.apache.lucene.codecs.PostingsFormat;
|
||||||
|
import org.apache.lucene.codecs.lucene40.Lucene40Codec;
|
||||||
|
import org.apache.lucene.codecs.mockintblock.MockVariableIntBlockPostingsFormat;
|
||||||
|
import org.apache.lucene.index.BasePostingsFormatTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic tests for VariableIntBlock
|
||||||
|
*/
|
||||||
|
public class TestVariableIntBlockPostingsFormat extends BasePostingsFormatTestCase {
|
||||||
|
// TODO: randomize blocksize
|
||||||
|
private final PostingsFormat postings = new MockVariableIntBlockPostingsFormat();
|
||||||
|
private final Codec codec = new Lucene40Codec() {
|
||||||
|
@Override
|
||||||
|
public PostingsFormat getPostingsFormatForField(String field) {
|
||||||
|
return postings;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Codec getCodec() {
|
||||||
|
return codec;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package org.apache.lucene.codecs.perfield;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.util.Collections;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.apache.lucene.codecs.Codec;
|
||||||
|
import org.apache.lucene.index.BasePostingsFormatTestCase;
|
||||||
|
import org.apache.lucene.index.RandomCodec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic tests of PerFieldPostingsFormat
|
||||||
|
*/
|
||||||
|
public class TestPerFieldPostingsFormat extends BasePostingsFormatTestCase {
|
||||||
|
private Codec codec;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
codec = new RandomCodec(new Random(random().nextLong()), Collections.EMPTY_SET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Codec getCodec() {
|
||||||
|
return codec;
|
||||||
|
}
|
||||||
|
}
|
|
@ -135,10 +135,10 @@ public abstract class BasePostingsFormatTestCase extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Holds all postings:
|
// Holds all postings:
|
||||||
private static Map<String,Map<BytesRef,List<Posting>>> fields = new TreeMap<String,Map<BytesRef,List<Posting>>>();
|
private static Map<String,Map<BytesRef,List<Posting>>> fields;
|
||||||
|
|
||||||
// Holds only live doc postings:
|
// Holds only live doc postings:
|
||||||
private static Map<String,Map<BytesRef,List<Posting>>> fieldsLive = new TreeMap<String,Map<BytesRef,List<Posting>>>();
|
private static Map<String,Map<BytesRef,List<Posting>>> fieldsLive;
|
||||||
|
|
||||||
private static FieldInfos fieldInfos;
|
private static FieldInfos fieldInfos;
|
||||||
|
|
||||||
|
@ -153,6 +153,8 @@ public abstract class BasePostingsFormatTestCase extends LuceneTestCase {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void createPostings() throws IOException {
|
public static void createPostings() throws IOException {
|
||||||
|
fields = new TreeMap<String,Map<BytesRef,List<Posting>>>();
|
||||||
|
fieldsLive = new TreeMap<String,Map<BytesRef,List<Posting>>>();
|
||||||
|
|
||||||
final int numFields = _TestUtil.nextInt(random(), 1, 5);
|
final int numFields = _TestUtil.nextInt(random(), 1, 5);
|
||||||
if (VERBOSE) {
|
if (VERBOSE) {
|
||||||
|
@ -368,7 +370,7 @@ public abstract class BasePostingsFormatTestCase extends LuceneTestCase {
|
||||||
for(int fieldUpto=0;fieldUpto<fields.size();fieldUpto++) {
|
for(int fieldUpto=0;fieldUpto<fields.size();fieldUpto++) {
|
||||||
FieldInfo oldFieldInfo = fieldInfos.fieldInfo(fieldUpto);
|
FieldInfo oldFieldInfo = fieldInfos.fieldInfo(fieldUpto);
|
||||||
|
|
||||||
String pf = _TestUtil.getPostingsFormat(oldFieldInfo.name);
|
String pf = _TestUtil.getPostingsFormat(codec, oldFieldInfo.name);
|
||||||
int fieldMaxIndexOption;
|
int fieldMaxIndexOption;
|
||||||
if (doesntSupportOffsets.contains(pf)) {
|
if (doesntSupportOffsets.contains(pf)) {
|
||||||
fieldMaxIndexOption = Math.min(maxIndexOptionNoOffsets, maxIndexOption);
|
fieldMaxIndexOption = Math.min(maxIndexOptionNoOffsets, maxIndexOption);
|
||||||
|
|
|
@ -662,7 +662,11 @@ public class _TestUtil {
|
||||||
// TODO: generalize all 'test-checks-for-crazy-codecs' to
|
// TODO: generalize all 'test-checks-for-crazy-codecs' to
|
||||||
// annotations (LUCENE-3489)
|
// annotations (LUCENE-3489)
|
||||||
public static String getPostingsFormat(String field) {
|
public static String getPostingsFormat(String field) {
|
||||||
PostingsFormat p = Codec.getDefault().postingsFormat();
|
return getPostingsFormat(Codec.getDefault(), field);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPostingsFormat(Codec codec, String field) {
|
||||||
|
PostingsFormat p = codec.postingsFormat();
|
||||||
if (p instanceof PerFieldPostingsFormat) {
|
if (p instanceof PerFieldPostingsFormat) {
|
||||||
return ((PerFieldPostingsFormat)p).getPostingsFormatForField(field).getName();
|
return ((PerFieldPostingsFormat)p).getPostingsFormatForField(field).getName();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue