You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by sh...@apache.org on 2015/07/13 10:17:58 UTC
svn commit: r1690583 - in
/manifoldcf/branches/CONNECTORS-1219/connectors/lucene/connector/src:
main/java/org/apache/manifoldcf/agents/output/lucene/LuceneDocument.java
test/java/org/apache/manifoldcf/agents/output/lucene/tests/LuceneClientTest.java
Author: shinichiro
Date: Mon Jul 13 08:17:58 2015
New Revision: 1690583
URL: http://svn.apache.org/r1690583
Log:
remove deprecated methods I marked yesterday
Modified:
manifoldcf/branches/CONNECTORS-1219/connectors/lucene/connector/src/main/java/org/apache/manifoldcf/agents/output/lucene/LuceneDocument.java
manifoldcf/branches/CONNECTORS-1219/connectors/lucene/connector/src/test/java/org/apache/manifoldcf/agents/output/lucene/tests/LuceneClientTest.java
Modified: manifoldcf/branches/CONNECTORS-1219/connectors/lucene/connector/src/main/java/org/apache/manifoldcf/agents/output/lucene/LuceneDocument.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1219/connectors/lucene/connector/src/main/java/org/apache/manifoldcf/agents/output/lucene/LuceneDocument.java?rev=1690583&r1=1690582&r2=1690583&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1219/connectors/lucene/connector/src/main/java/org/apache/manifoldcf/agents/output/lucene/LuceneDocument.java (original)
+++ manifoldcf/branches/CONNECTORS-1219/connectors/lucene/connector/src/main/java/org/apache/manifoldcf/agents/output/lucene/LuceneDocument.java Mon Jul 13 08:17:58 2015
@@ -28,16 +28,11 @@ import java.util.Map;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.Field.Store;
import org.apache.lucene.document.FieldType;
-import org.apache.lucene.document.StringField;
-import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.util.BytesRef;
-import org.apache.manifoldcf.agents.output.lucene.LuceneClient.TermVector;
import com.google.common.base.Objects;
-import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteSource;
import com.google.common.io.ByteStreams;
@@ -72,24 +67,6 @@ public class LuceneDocument {
TEXT_NOT_STORED.freeze();
}
- @Deprecated
- private static final FieldType TEXT_STORED_WITH_TV = new FieldType(TextField.TYPE_STORED);
- static {
- TEXT_STORED_WITH_TV.setStoreTermVectors(true);
- TEXT_STORED_WITH_TV.setStoreTermVectorOffsets(true);
- TEXT_STORED_WITH_TV.setStoreTermVectorPositions(true);
- TEXT_STORED_WITH_TV.freeze();
- }
-
- @Deprecated
- private static final FieldType TEXT_NOT_STORED_WITH_TV = new FieldType(TEXT_NOT_STORED);
- static {
- TEXT_NOT_STORED_WITH_TV.setStoreTermVectors(true);
- TEXT_NOT_STORED_WITH_TV.setStoreTermVectorOffsets(true);
- TEXT_NOT_STORED_WITH_TV.setStoreTermVectorPositions(true);
- TEXT_NOT_STORED_WITH_TV.freeze();
- }
-
private static final FieldType TEXT_NOT_STORED_WITH_TV_YES = new FieldType(TEXT_NOT_STORED);
static {
TEXT_NOT_STORED_WITH_TV_YES.setStoreTermVectors(true);
@@ -122,20 +99,6 @@ public class LuceneDocument {
doc = new Document();
}
- @Deprecated
- public LuceneDocument addStringField(String name, String value, boolean store) {
- Store stored = (store) ? Field.Store.YES : Field.Store.NO;
- doc.add(new StringField(name, value, stored));
- return this;
- }
-
- @Deprecated
- public LuceneDocument addTextField(String name, String value, boolean store) {
- FieldType type = (store) ? TEXT_STORED_WITH_TV : TEXT_NOT_STORED_WITH_TV;
- doc.add(new Field(name, value, type));
- return this;
- }
-
public LuceneDocument addStringField(String name, BytesRef value) {
doc.add(new Field(name, value, STRING_NOT_STORED));
return this;
@@ -143,15 +106,15 @@ public class LuceneDocument {
public LuceneDocument addTextField(String name, Reader value, String termvector) {
FieldType ftype = null;
- if (termvector.equals(TermVector.NO.toString())) {
+ if (termvector.equals(LuceneClient.TermVector.NO.toString())) {
ftype = TEXT_NOT_STORED;
- } else if (termvector.equals(TermVector.YES.toString())) {
+ } else if (termvector.equals(LuceneClient.TermVector.YES.toString())) {
ftype = TEXT_NOT_STORED_WITH_TV_YES;
- } else if (termvector.equals(TermVector.WITH_POSITIONS.toString())) {
+ } else if (termvector.equals(LuceneClient.TermVector.WITH_POSITIONS.toString())) {
ftype = TEXT_NOT_STORED_WITH_TV_POSITIONS;
- } else if (termvector.equals(TermVector.WITH_OFFSETS.toString())) {
+ } else if (termvector.equals(LuceneClient.TermVector.WITH_OFFSETS.toString())) {
ftype = TEXT_NOT_STORED_WITH_TV_OFFSETS;
- } else if (termvector.equals(TermVector.WITH_POSITIONS_OFFSETS.toString())) {
+ } else if (termvector.equals(LuceneClient.TermVector.WITH_POSITIONS_OFFSETS.toString())) {
ftype = TEXT_NOT_STORED_WITH_TV_POSITIONS_OFFSETS;
}
doc.add(new Field(name, value, ftype));
@@ -167,29 +130,10 @@ public class LuceneDocument {
return doc;
}
- @Deprecated
- public static LuceneDocument addFieldDeprecated(LuceneDocument from, String field, String value, Map<String,Map<String,Object>> fieldsInfo) {
- String fieldtype = (String)fieldsInfo.get(field).get(LuceneClient.ATTR_FIELDTYPE);
- boolean store = (boolean)Objects.firstNonNull(fieldsInfo.get(field).get(LuceneClient.ATTR_STORE), false);
-
- if (fieldtype.equals(LuceneClient.FieldType.TEXT.toString())) {
- from.addTextField(field, value, store);
- } else if (fieldtype.equals(LuceneClient.FieldType.STRING.toString())) {
- from.addStringField(field, value, store);
- }
-
- @SuppressWarnings("unchecked")
- List<String> copyFields = (List<String>)Objects.firstNonNull(fieldsInfo.get(field).get(LuceneClient.ATTR_COPY_TO), new ArrayList<String>());
- for (String tofield : copyFields) {
- from = addFieldDeprecated(from, tofield, value, fieldsInfo);
- }
- return from;
- }
-
public static LuceneDocument addField(LuceneDocument from, String field, Object value, Map<String,Map<String,Object>> fieldsInfo) throws IOException {
String type = (String)fieldsInfo.get(field).get(LuceneClient.ATTR_FIELDTYPE);
boolean store = (boolean)Objects.firstNonNull(fieldsInfo.get(field).get(LuceneClient.ATTR_STORE), false);
- String termvector = (String)Objects.firstNonNull(fieldsInfo.get(field).get(LuceneClient.ATTR_TERM_VECTOR), TermVector.NO.toString());
+ String termvector = (String)Objects.firstNonNull(fieldsInfo.get(field).get(LuceneClient.ATTR_TERM_VECTOR), LuceneClient.TermVector.NO.toString());
@SuppressWarnings("unchecked")
List<String> copyFields = (List<String>)Objects.firstNonNull(fieldsInfo.get(field).get(LuceneClient.ATTR_COPY_TO), new ArrayList<String>());
Modified: manifoldcf/branches/CONNECTORS-1219/connectors/lucene/connector/src/test/java/org/apache/manifoldcf/agents/output/lucene/tests/LuceneClientTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1219/connectors/lucene/connector/src/test/java/org/apache/manifoldcf/agents/output/lucene/tests/LuceneClientTest.java?rev=1690583&r1=1690582&r2=1690583&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1219/connectors/lucene/connector/src/test/java/org/apache/manifoldcf/agents/output/lucene/tests/LuceneClientTest.java (original)
+++ manifoldcf/branches/CONNECTORS-1219/connectors/lucene/connector/src/test/java/org/apache/manifoldcf/agents/output/lucene/tests/LuceneClientTest.java Mon Jul 13 08:17:58 2015
@@ -33,19 +33,20 @@ import org.apache.lucene.search.MatchAll
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.util.BytesRef;
+
import org.apache.manifoldcf.agents.interfaces.RepositoryDocument;
import org.apache.manifoldcf.agents.output.lucene.LuceneClient;
import org.apache.manifoldcf.agents.output.lucene.LuceneClientManager;
import org.apache.manifoldcf.agents.output.lucene.LuceneDocument;
import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
import org.apache.manifoldcf.core.system.ManifoldCF;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
import com.google.common.base.StandardSystemProperty;
import com.google.common.io.ByteSource;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;