Below is the test script that I used.  I'm on MacOS

I realize faceting on tokenized text fields is a bit atypical, but I use it
as a dev tool to check the index.

Here's the pertinent diff:
115c117
<
"test_t":["a",1,"indexing",1,"is",1,"of",1,"solr",1,"system",1,"terms",1,"test",1,"the",1,"this",1]
---
>       "test_t":[ ]


Here's my test script:

#!/bin/bash

COLLECTION=test
NUM_SHARDS=1  # Solr v9 (maybe earlier) doesn't restrict to single shard,
BUT doesn't matter for our small dataset
TERMS=test
TYPE=text_general
SUFFIX=_t
FIELD=test$SUFFIX
DOC_ID=doc1

echo;echo
echo Removing Any Previous collection - will give error if run for the
first time
curl "
http://localhost:8983/solr/admin/collections?action=DELETE&name=$COLLECTION";

echo;echo
echo Creating Collection $COLLECTION with $NUM_SHARDS shards
curl "
http://localhost:8983/solr/admin/collections?action=CREATE&name=$COLLECTION&numShards=$NUM_SHARDS&replicationFactor=1&maxShardsPerNode=$NUM_SHARDS
"

echo;echo
echo Adding doc id = $DOC_ID with TERMS = $TERMS
curl -X POST "http://localhost:8983/solr/$COLLECTION/update?commit=true"; \
     -H "Content-Type: application/json" \
     -d "[
       {
         \"id\": \"$DOC_ID\",
         \"$FIELD\": \"this is a test of the Solr indexing system: TERMS =
$TERMS\"
       }
     ]"

echo;echo
echo Query for all docs
curl "http://localhost:8983/solr/$COLLECTION/select?q=*:*";

echo;echo
echo Query for TERMS = $TERMS
curl "
http://localhost:8983/solr/$COLLECTION/select?defType=edismax&qf=$FIELD&q=$TERMS&rows=1
"

echo;echo
echo Testing Facet API
curl "
http://localhost:8983/solr/$COLLECTION/select?q=*:*&rows=0&facet=true&facet.field=$FIELD
"

echo;echo
echo Done

Reply via email to