Skip to content

Commit 453666e

Browse files
committed
Change to use JSON; add names example
1 parent e2a69e3 commit 453666e

File tree

4 files changed

+25
-42
lines changed

4 files changed

+25
-42
lines changed

exampledocs/clear.xml

-4
This file was deleted.

exampledocs/names.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"add": {
3+
"doc": {
4+
"id": "1",
5+
"name_text": ["William John Dueber", "David Thomas Jones"]
6+
}
7+
},
8+
"add": {
9+
"doc": {
10+
"id": 2,
11+
"name_text": ["Mike Dueber", "William Penn"]
12+
}
13+
}
14+
}

exampledocs/names.xml

-33
This file was deleted.

exampledocs/post.sh exampledocs/reset_and_index_json.sh

+11-5
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@
1515
# limitations under the License.
1616

1717
FILES=$*
18-
URL=http://localhost:8983/solr/update
18+
URL='http://localhost:8983/solr/update/json?wt=json'
1919

20+
# Clear it out
21+
echo
22+
echo "Clearing out solr (delete all)"
23+
curl $URL -s -d '{"delete": { "query":"*:*" }, "commit": {}}' -H 'Content-type:application/json' > /dev/null
24+
25+
echo 'Posting file(s)'
2026
for f in $FILES; do
21-
echo Posting file $f to $URL
22-
curl $URL --data-binary @$f -H 'Content-type:application/xml'
23-
echo
27+
echo " - $f"
28+
curl $URL -s -d @$f -H 'Content-type:application/json' > /dev/null
2429
done
2530

2631
#send the commit command to make sure all the changes are flushed and visible
27-
curl $URL --data-binary '<commit/>' -H 'Content-type:application/xml'
32+
echo "Final commit"
33+
curl $URL -s -d '{"commit": {}}' -H 'Content-type:application/json' > /dev/null
2834
echo

0 commit comments

Comments
 (0)