Skip to content

Commit 2b86f72

Browse files
authored
Merge pull request #1826 from vespa-engine/kkraune/linguistics
add details to guide
2 parents b20b3e8 + 23a666f commit 2b86f72

File tree

1 file changed

+40
-14
lines changed
  • examples/lucene-linguistics/non-java

1 file changed

+40
-14
lines changed

examples/lucene-linguistics/non-java/README.md

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
1+
<!-- Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
32

43
<picture>
54
<source media="(prefers-color-scheme: dark)" srcset="https://assets.vespa.ai/logos/Vespa-logo-green-RGB.svg">
@@ -9,48 +8,75 @@
98

109
# Vespa sample applications - Lucene Linguistics
1110

12-
This app demonstrates using [Lucene Linguistics](https://docs.vespa.ai/en/lucene-linguistics.html).
13-
11+
This app demonstrates using [Lucene Linguistics](https://docs.vespa.ai/en/linguistics/lucene-linguistics.html).
1412

1513
<p data-test="run-macro init-deploy examples/lucene-linguistics/non-java">
1614
Requires at least Vespa 8.315.19
1715
</p>
1816

19-
## To try this application
20-
21-
Follow [Vespa getting started](https://docs.vespa.ai/en/basics/deploy-an-application)
17+
Follow [app deploy guide](https://docs.vespa.ai/en/basics/deploy-an-application)
2218
through the <code>vespa deploy</code> step, cloning `examples/lucene-linguistics/non-java` instead of `album-recommendation`.
2319

20+
21+
## Feed test data
2422
Feed 3 sample documents in Norwegian, Swedish, and Finnish:
2523

2624
<pre data-test="exec">
2725
vespa feed ext/*.json
2826
</pre>
2927

30-
Example queries:
28+
29+
## Run queries
3130

3231
<pre data-test="exec" data-test-assert-contains="id:no:doc::1">
33-
vespa query 'yql=select * from doc where userQuery()'\
32+
vespa query 'yql=select * from doc where userInput(@query)'\
3433
'language=no' 'summary=debug-text-tokens' \
3534
'query=tips til utendørsaktiviteter'
3635
</pre>
3736

3837
<pre data-test="exec" data-test-assert-contains="id:sv:doc::1">
39-
vespa query 'yql=select * from doc where userQuery()'\
38+
vespa query 'yql=select * from doc where userInput(@query)'\
4039
'language=sv' 'summary=debug-text-tokens' \
4140
'query=tips til utomhusaktiviteter'
4241
</pre>
4342

4443
<pre data-test="exec" data-test-assert-contains="id:fi:doc::1">
45-
vespa query 'yql=select * from doc where userQuery()'\
44+
vespa query 'yql=select * from doc where userInput(@query)'\
4645
'language=fi' 'summary=debug-text-tokens' \
4746
'query=vinkkejä ulkoilma-aktiviteetteihin'
4847
</pre>
4948

50-
### Terminate container
49+
Using the [tokens](https://docs.vespa.ai/en/reference/schemas/schemas.html#tokens) feature,
50+
you can easily inspect the tokens generated by the linguistics processing
51+
52+
53+
### Use query tracing for insights
54+
Observe the query term linguistic processing in the trace output:
55+
56+
<pre data-test="exec" data-test-assert-contains="id:no:doc::1">
57+
vespa query 'yql=select * from doc where userInput(@query)'\
58+
language=no summary=debug-text-tokens \
59+
'query=tips til utendørsaktiviteter' \
60+
tracelevel=1
61+
</pre>
5162

52-
Remove the container after use (Only relevant for local deployments)
63+
64+
Increasing tracelevel is often useful:
65+
66+
<pre data-test="exec" data-test-assert-contains="id:no:doc::1">
67+
vespa query 'yql=select * from doc where ({grammar: "linguistics"}userInput(@query))'\
68+
language=no summary=debug-text-tokens \
69+
'query=tips til utendørsaktiviteter' \
70+
tracelevel=3
71+
</pre>
72+
73+
Above, you will find output like _"Stemming with language NORWEGIAN_BOKMAL using LuceneLinguistics"_ -
74+
This helps you validate that your application config is correct
75+
76+
77+
78+
## Cleanup
79+
For local deployments: Remove the container after use:
5380
<pre data-test="exec">
5481
$ docker rm -f vespa
5582
</pre>
56-

0 commit comments

Comments
 (0)