LUCENE-4197 remove 3 unused classes in the spatial module

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1361910 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David Wayne Smiley 2012-07-16 05:27:26 +00:00
parent 7002e7cb09
commit c36c959a80
3 changed files with 0 additions and 158 deletions

View File

@ -1,49 +0,0 @@
/*
* 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.
*/
package org.apache.lucene.spatial.util;
import org.apache.lucene.document.DoubleField;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexableField;
/**
* Hold some of the parameters used by solr...
* @lucene.experimental
*/
public class NumericFieldInfo {
public int precisionStep = 8; // same as solr default
public boolean store = true;
public boolean index = true;
public void setPrecisionStep( int p ) {
precisionStep = p;
if (precisionStep<=0 || precisionStep>=64)
precisionStep=Integer.MAX_VALUE;
}
public IndexableField createDouble( String name, double v ) {
if (!store && !index)
throw new IllegalArgumentException("field must be indexed or stored");
FieldType fieldType = new FieldType(DoubleField.TYPE_NOT_STORED);
fieldType.setStored(store);
fieldType.setIndexed(index);
fieldType.setNumericPrecisionStep(precisionStep);
return new DoubleField(name,v,fieldType);
}
}

View File

@ -1,57 +0,0 @@
/*
* 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.
*/
package org.apache.lucene.spatial.util;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import java.io.IOException;
import java.util.Iterator;
/**
* Put a list of strings directly into the token stream.
* @lucene.internal
*/
public final class StringListTokenizer extends TokenStream {
private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
private final Iterable<String> tokens;
private Iterator<String> iter = null;
public StringListTokenizer(Iterable<String> tokens) {
this.tokens = tokens;
}
@Override
public boolean incrementToken() {
if (iter.hasNext()) {
clearAttributes();
String t = iter.next();
termAtt.append(t);
return true;
}
return false;
}
@Override
public void reset() throws IOException {
super.reset();
iter = tokens.iterator();
}
}

View File

@ -1,52 +0,0 @@
/*
* 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.
*/
package org.apache.lucene.spatial.util;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import java.io.IOException;
/**
* @lucene.internal
*/
public class TruncateFilter extends TokenFilter {
private final int maxTokenLength;
private final CharTermAttribute termAttr = addAttribute(CharTermAttribute.class);
public TruncateFilter(TokenStream in, int maxTokenLength) {
super(in);
this.maxTokenLength = maxTokenLength;
}
@Override
public final boolean incrementToken() throws IOException {
if (!input.incrementToken()) {
return false;
}
if (termAttr.length() > maxTokenLength) {
termAttr.setLength(maxTokenLength);
}
return true;
}
}