From 387620255a874c4ad2cc640e3c30c2b3e5e4bdfb Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1s=C3=A1ry=20D=C3=A1niel?= Date: Fri, 13 Sep 2019 09:22:33 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31523 --- .../hu/user/mediacube/indexer/TestSolr.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/server/hu.user.mediacube.indexer/src/test/java/hu/user/mediacube/indexer/TestSolr.java b/server/hu.user.mediacube.indexer/src/test/java/hu/user/mediacube/indexer/TestSolr.java index 5a440ffb..c321730e 100644 --- a/server/hu.user.mediacube.indexer/src/test/java/hu/user/mediacube/indexer/TestSolr.java +++ b/server/hu.user.mediacube.indexer/src/test/java/hu/user/mediacube/indexer/TestSolr.java @@ -20,14 +20,18 @@ public class TestSolr { HttpSolrClient client = new HttpSolrClient.Builder(solrUrl).withConnectionTimeout(10000).withSocketTimeout(60000).build(); try { + String collection = "mediacube"; //add - final SolrInputDocument doc = new SolrInputDocument(); - doc.addField("id", 2); - doc.addField("name", "Name1"); - doc.addField("description", "Amazon Kindle Paperwhite"); + SolrInputDocument doc = new SolrInputDocument(); + doc.addField("id", 4); + doc.addField("name", "Fuck You"); + UpdateResponse updateResponse = client.add(collection, doc); + + doc = new SolrInputDocument(); + doc.addField("id", 5); + doc.addField("name", "450 ezer forintos büntetésre ítélték a mentőautókon végiggyalogló turistákat"); + updateResponse = client.add(collection, doc); - String collection = "mediacube"; - final UpdateResponse updateResponse = client.add(collection, doc); client.commit(collection); //query @@ -40,9 +44,9 @@ public class TestSolr { System.out.println("Found " + documents.getNumFound() + " documents"); for (SolrDocument document : documents) { final String id = (String) document.getFirstValue("id"); - final String name = (String) document.getFirstValue("description"); + final String name = (String) document.getFirstValue("name"); - System.out.println("id: " + id + "; description: " + name); + System.out.println("id: " + id + "; name: " + name); } } catch (Exception e) { System.out.println(e.getMessage()); -- 2.54.0