You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jb...@apache.org on 2019/08/04 22:52:54 UTC

[lucene-solr] 02/02: SOLR-13105: Add text to loading page 1

This is an automated email from the ASF dual-hosted git repository.

jbernste pushed a commit to branch SOLR-13105-visual
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit b802eef6826cf751e198c9f40f43e574715e92f9
Author: Joel Bernstein <jb...@apache.org>
AuthorDate: Sun Aug 4 18:52:18 2019 -0400

    SOLR-13105: Add text to loading page 1
---
 .../src/images/math-expressions/csv.png            | Bin 149359 -> 166057 bytes
 .../src/images/math-expressions/csvtable.png       | Bin 0 -> 180593 bytes
 solr/solr-ref-guide/src/loading.adoc               | 103 ++++++++++++++++++++-
 3 files changed, 101 insertions(+), 2 deletions(-)

diff --git a/solr/solr-ref-guide/src/images/math-expressions/csv.png b/solr/solr-ref-guide/src/images/math-expressions/csv.png
index 09bc986..817e033 100644
Binary files a/solr/solr-ref-guide/src/images/math-expressions/csv.png and b/solr/solr-ref-guide/src/images/math-expressions/csv.png differ
diff --git a/solr/solr-ref-guide/src/images/math-expressions/csvtable.png b/solr/solr-ref-guide/src/images/math-expressions/csvtable.png
new file mode 100644
index 0000000..e8c042c
Binary files /dev/null and b/solr/solr-ref-guide/src/images/math-expressions/csvtable.png differ
diff --git a/solr/solr-ref-guide/src/loading.adoc b/solr/solr-ref-guide/src/loading.adoc
index 7009aba..32dcab0 100644
--- a/solr/solr-ref-guide/src/loading.adoc
+++ b/solr/solr-ref-guide/src/loading.adoc
@@ -39,7 +39,48 @@ emits a tuple with two fields:
 * line: The text in the line.
 * file: The relative path of the file under SOLR_HOME.
 
-Below is an example of `cat`.
+Below is an example of `cat` on the iris.csv file with a maxLines of 5:
+
+[source,text]
+----
+cat("iris.csv", maxLines="5")
+----
+
+When this expression is sent to the `/stream` handler it responds with:
+
+[source,json]
+----
+{
+  "result-set": {
+    "docs": [
+      {
+        "line": "sepal_length,sepal_width,petal_length,petal_width,species",
+        "file": "iris.csv"
+      },
+      {
+        "line": "5.1,3.5,1.4,0.2,setosa",
+        "file": "iris.csv"
+      },
+      {
+        "line": "4.9,3,1.4,0.2,setosa",
+        "file": "iris.csv"
+      },
+      {
+        "line": "4.7,3.2,1.3,0.2,setosa",
+        "file": "iris.csv"
+      },
+      {
+        "line": "4.6,3.1,1.5,0.2,setosa",
+        "file": "iris.csv"
+      },
+      {
+        "EOF": true,
+        "RESPONSE_TIME": 0
+      }
+    ]
+  }
+}
+----
 
 
 == Parsing CSV and TSV Files
@@ -48,12 +89,70 @@ The `parseCSV` and `parseTSV` functions wrap the `cat` function and parse CSV
 (comma separated values) and TSV (tab separated values). Both of these functions
 expect a CSV or TSV header record at the beginning of each file.
 
-Both `parseCSV` and `parseTSV` emit tuples with header values mapped to their
+Both `parseCSV` and `parseTSV` emit tuples with the header values mapped to their
 corresponding values in each line.
 
 
+[source,text]
+----
+parseCSV(cat("iris.csv", maxLines="5"))
+----
+
+When this expression is sent to the `/stream` handler it responds with:
+
+[source,json]
+----
+{
+  "result-set": {
+    "docs": [
+      {
+        "sepal_width": "3.5",
+        "species": "setosa",
+        "petal_width": "0.2",
+        "sepal_length": "5.1",
+        "id": "iris.csv_2",
+        "petal_length": "1.4"
+      },
+      {
+        "sepal_width": "3",
+        "species": "setosa",
+        "petal_width": "0.2",
+        "sepal_length": "4.9",
+        "id": "iris.csv_3",
+        "petal_length": "1.4"
+      },
+      {
+        "sepal_width": "3.2",
+        "species": "setosa",
+        "petal_width": "0.2",
+        "sepal_length": "4.7",
+        "id": "iris.csv_4",
+        "petal_length": "1.3"
+      },
+      {
+        "sepal_width": "3.1",
+        "species": "setosa",
+        "petal_width": "0.2",
+        "sepal_length": "4.6",
+        "id": "iris.csv_5",
+        "petal_length": "1.5"
+      },
+      {
+        "EOF": true,
+        "RESPONSE_TIME": 1
+      }
+    ]
+  }
+}
+----
+
 == Visualizing
 
+image::images/math-expressions/csvtable.png[]
+
+image::images/math-expressions/csv.png[]
+
+
 == Transforming Data
 
 === Selecting fields