Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

example/films: README.md and vectors tweaks (#2238)

Christine Poerschke73b4043a389d
diff --git a/solr/example/films/README.md b/solr/example/films/README.md
index 0e7229df720..a42e097cc8b 100644
--- a/solr/example/films/README.md
+++ b/solr/example/films/README.md
@@ -1,6 +1,6 @@
We have a movie data set in JSON, Solr XML, and CSV formats. All 3 formats contain the same data. You can use any one format to index documents to Solr.
-This example uses the `_default` configset that ships with Solr plus some custom fields added via Schema API. It demonstrates the use of ParamSets in conjunction with the [Request Parameters API](https://solr.apache.org/guide/solr/latest/configuration-guide/request-parameters-api.html).
+This example uses the `_default` configset that ships with Solr plus some custom fields added via Schema API as described [here](https://solr.apache.org/guide/solr/latest/getting-started/tutorial-vectors.html#preparing-for-the-vector-data) in the Solr Reference Guide. It demonstrates the use of ParamSets in conjunction with the [Request Parameters API](https://solr.apache.org/guide/solr/latest/configuration-guide/request-parameters-api.html).
The original data was fetched from Freebase and the data license is present in the films-LICENSE.txt file. Freebase was shutdown in 2016 by Google.
diff --git a/solr/example/films/vectors/create_model.py b/solr/example/films/vectors/create_model.py
index 84a437aa57a..abbd03c2723 100755
--- a/solr/example/films/vectors/create_model.py
+++ b/solr/example/films/vectors/create_model.py
@@ -50,7 +50,7 @@ pathlib.Path("./models/").mkdir(parents=True, exist_ok=True)
model = SentenceTransformer("all-mpnet-base-v2")
# New size for the embeddings
-new_dimension = 10
+new_dimension = films.FILMS_MODEL_NEW_DIMENSION
######## Evaluate performance of full model ########
diff --git a/solr/example/films/vectors/films.py b/solr/example/films/vectors/films.py
index cd1a712eb39..acf211125c7 100644
--- a/solr/example/films/vectors/films.py
+++ b/solr/example/films/vectors/films.py
@@ -15,13 +15,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import os
import json
import csv
from lxml import etree
from sentence_transformers import SentenceTransformer
+FILMS_MODEL_NEW_DIMENSION = int(os.getenv("FILMS_MODEL_NEW_DIMENSION", "10"))
+
PATH_FILMS_DATASET = "../films.json"
-PATH_FILMS_MODEL = "./models/films-model-size_10"
+PATH_FILMS_MODEL = f"./models/films-model-size_{FILMS_MODEL_NEW_DIMENSION}"
PATH_FILMS_VECTORS_JSON = "./data/films-vectors.json"
PATH_FILMS_VECTORS_XML = "./data/films-vectors.xml"
PATH_FILMS_VECTORS_CSV = "./data/films-vectors.csv"
diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-vectors.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-vectors.adoc
index 42a3174658f..63cffc16542 100644
--- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-vectors.adoc
+++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-vectors.adoc
@@ -111,7 +111,7 @@ be used as the input vector for all the following example queries.
[NOTE]
====
Interested in calculating the vector using Solr's xref:query-guide:streaming-expressions.adoc[streaming capability]?
-Here is an example of a streaming expression that you can run via the Solr Admin Stream UI:
+Here is an example of a streaming expression that you can run via the xref:query-guide:stream-screen.adoc[Solr Admin Stream UI]:
```
let(
a=select(