use of de.tblsoft.solr.pipeline.bean.Field in project solr-cmd-utils by tblsoft.
the class CompoundWordFilterTest method testTurmdeckelschnecke.
@Test
@Ignore
public void testTurmdeckelschnecke() {
configure();
document(DocumentBuilder.document().field("noun", "turmdeckelschnecke").create(), DocumentBuilder.document().field("noun", "turm").create(), DocumentBuilder.document().field("noun", "schnecke").create(), DocumentBuilder.document().field("noun", "blumen").create(), DocumentBuilder.document().field("noun", "blume").create());
Field d = outputDocumentList.get(0).getField("tokenized");
assertFiledList("tokenized", "maurer", "hammer");
}
use of de.tblsoft.solr.pipeline.bean.Field in project solr-cmd-utils by tblsoft.
the class BeanTest method testFieldBeanWithNoValue.
@Test
public void testFieldBeanWithNoValue() {
String value = null;
Field f = new Field("foo", value);
f.setValues(new ArrayList<String>());
Assert.assertNull(f.getValue());
}
use of de.tblsoft.solr.pipeline.bean.Field in project solr-cmd-utils by tblsoft.
the class FileLineWriter method document.
@Override
public void document(Document document) {
if (fieldNames == null) {
for (Field field : document.getFields()) {
for (String value : field.getValues()) {
field(field.getName(), value);
}
}
} else {
for (String fieldName : fieldNames) {
Field field = document.getField(fieldName);
if (field != null) {
for (String value : field.getValues()) {
field(field.getName(), value);
}
}
}
}
endDocument(document);
super.document(document);
}
use of de.tblsoft.solr.pipeline.bean.Field in project solr-cmd-utils by tblsoft.
the class TokenizerFilter method document.
@Override
public void document(Document document) {
for (Field field : document.getFields()) {
for (String value : field.getValues()) {
StringTokenizer tokenizer = new StringTokenizer(value, delim);
while (tokenizer.hasMoreElements()) {
String token = tokenizer.nextToken();
Document newDocument = new Document();
newDocument.addField("token", token);
super.document(newDocument);
}
}
}
}
use of de.tblsoft.solr.pipeline.bean.Field in project solr-cmd-utils by tblsoft.
the class TopicAggregationFilter method putTopicValueAsField.
protected void putTopicValueAsField(Document document) {
Map<String, Field> fieldMap = DocumentUtils.mapFields(document);
if (fieldMap.containsKey(fieldTopic) && fieldMap.containsKey(fieldValue)) {
Field topicField = fieldMap.get(fieldTopic);
Field valueField = fieldMap.get(fieldValue);
document.setField(topicField.getValue(), valueField.getValues());
document.deleteField(fieldTopic);
document.deleteField(fieldValue);
}
}
Aggregations