diff --git a/source/net/yacy/cora/services/federated/solr/SolrDoc.java b/source/net/yacy/cora/services/federated/solr/SolrDoc.java new file mode 100644 index 000000000..074360dbe --- /dev/null +++ b/source/net/yacy/cora/services/federated/solr/SolrDoc.java @@ -0,0 +1,75 @@ +/** + * SolrDoc + * Copyright 2011 by Michael Peter Christen + * First released 09.05.2012 at http://yacy.net + * + * $LastChangedDate: 2011-04-14 22:05:04 +0200 (Do, 14 Apr 2011) $ + * $LastChangedRevision: 7654 $ + * $LastChangedBy: orbiter $ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program in the file lgpl21.txt + * If not, see . + */ + +package net.yacy.cora.services.federated.solr; + +import java.util.Date; +import java.util.List; + +import org.apache.solr.common.SolrInputDocument; + +/** + * helper class to produce SolrInputDocuments + */ +public class SolrDoc extends SolrInputDocument { + + private static final long serialVersionUID=1L; + + public SolrDoc() { + super(); + } + + public final void addSolr(final SolrField key, final String value) { + this.setField(key.name(), value); + } + + public final void addSolr(final SolrField key, final Date value) { + this.setField(key.name(), value); + } + + public final void addSolr(final SolrField key, final int value) { + this.setField(key.name(), value); + } + + public final void addSolr(final SolrField key, final String[] value) { + this.setField(key.name(), value); + } + + public final void addSolr(final SolrField key, final List value) { + this.setField(key.name(), value.toArray(new String[value.size()])); + } + + public final void addSolr(final SolrField key, final float value) { + this.setField(key.name(), value); + } + + public final void addSolr(final SolrField key, final boolean value) { + this.setField(key.name(), value); + } + + public final void addSolr(final SolrField key, final String value, final float boost) { + this.setField(key.name(), value, boost); + } + +} diff --git a/source/net/yacy/cora/services/federated/solr/SolrScheme.java b/source/net/yacy/cora/services/federated/solr/SolrScheme.java new file mode 100644 index 000000000..f58a910d2 --- /dev/null +++ b/source/net/yacy/cora/services/federated/solr/SolrScheme.java @@ -0,0 +1,32 @@ +/** + * SolrScheme + * Copyright 2011 by Michael Peter Christen + * First released 09.05.2012 at http://yacy.net + * + * $LastChangedDate: 2011-04-14 22:05:04 +0200 (Do, 14 Apr 2011) $ + * $LastChangedRevision: 7654 $ + * $LastChangedBy: orbiter $ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program in the file lgpl21.txt + * If not, see . + */ + +package net.yacy.cora.services.federated.solr; + + +public interface SolrScheme { + + public SolrDoc toSolr(); + +}