Search in sources :

Example 11 with Document

use of de.tblsoft.solr.pipeline.bean.Document in project solr-cmd-utils by tblsoft.

the class NetbaseReader method processBatch.

private void processBatch(Gson gson, String response) {
    JsonElement jsonResponse = gson.fromJson(response, JsonElement.class);
    Iterator<JsonElement> hitsIterator = jsonResponse.getAsJsonObject().get("results").getAsJsonArray().get(0).getAsJsonObject().get("statements").getAsJsonArray().iterator();
    while (hitsIterator.hasNext()) {
        Document document = new Document();
        for (Entry<String, JsonElement> entry : hitsIterator.next().getAsJsonObject().entrySet()) {
            if (entry.getValue().isJsonArray()) {
            } else if (entry.getValue().isJsonPrimitive()) {
                document.addField(entry.getKey(), entry.getValue().getAsString());
            }
        }
        executer.document(document);
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Document(de.tblsoft.solr.pipeline.bean.Document)

Example 12 with Document

use of de.tblsoft.solr.pipeline.bean.Document in project solr-cmd-utils by tblsoft.

the class OpenThesaurusReader method token2document.

void token2document(String[] lineParts) {
    for (String token : lineParts) {
        Document document = new Document();
        document.setField("token", token);
        executer.document(document);
    }
}
Also used : Document(de.tblsoft.solr.pipeline.bean.Document)

Example 13 with Document

use of de.tblsoft.solr.pipeline.bean.Document in project solr-cmd-utils by tblsoft.

the class PipelineSaxContentHandler method startElement.

@Override
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
    currentName = null;
    if ("document".equals(localName)) {
        currentDocument = new Document();
    }
    if ("field".equals(localName)) {
        currentName = atts.getValue("name");
    }
    currentValue = new StringBuilder();
}
Also used : Document(de.tblsoft.solr.pipeline.bean.Document)

Example 14 with Document

use of de.tblsoft.solr.pipeline.bean.Document in project solr-cmd-utils by tblsoft.

the class SolrQueryLogReader method logRow.

protected void logRow(SolrLogRow solrLogRow) {
    Document document = new Document();
    document.addField("coreName", solrLogRow.getCoreName());
    document.addField("hits", String.valueOf(solrLogRow.getHits()));
    document.addField("fileName", solrLogRow.getLogFile());
    document.addField("dirName", currentDirName);
    document.addField("queryTime", String.valueOf(solrLogRow.getqTime()));
    document.addField("date", date2String(solrLogRow.getTimestamp()));
    document.addField("url", solrLogRow.getUrl());
    document.addField("raw", solrLogRow.getRaw());
    executer.document(document);
}
Also used : Document(de.tblsoft.solr.pipeline.bean.Document)

Example 15 with Document

use of de.tblsoft.solr.pipeline.bean.Document in project solr-cmd-utils by tblsoft.

the class StandardReader method endDocument.

@Override
public void endDocument() {
    executer.document(document);
    document = new Document();
}
Also used : Document(de.tblsoft.solr.pipeline.bean.Document)

Aggregations

Document (de.tblsoft.solr.pipeline.bean.Document)51 ArrayList (java.util.ArrayList)9 Map (java.util.Map)9 Test (org.junit.Test)9 Field (de.tblsoft.solr.pipeline.bean.Field)8 DocumentDiff (de.tblsoft.solr.pipeline.bean.DocumentDiff)4 AbstractFilterTest (de.tblsoft.solr.pipeline.test.AbstractFilterTest)4 GsonBuilder (com.google.gson.GsonBuilder)3 Match (oi.thekraken.grok.api.Match)3 AtomicLongMap (com.google.common.util.concurrent.AtomicLongMap)2 Gson (com.google.gson.Gson)2 JsonElement (com.google.gson.JsonElement)2 DocumentContext (com.jayway.jsonpath.DocumentContext)2 PathNotFoundException (com.jayway.jsonpath.PathNotFoundException)2 DocumentBuilder (de.tblsoft.solr.pipeline.bean.DocumentBuilder)2 SimpleMapping (de.tblsoft.solr.pipeline.filter.SimpleMapping)2 File (java.io.File)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 InputStreamReader (java.io.InputStreamReader)2