You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can also force a different profile for the query via `model.type.profile`. This will match "dubious" with "special" (our test synonym expansion):
51
+
### Different profiles for query and index
52
+
53
+
For the `description` field, [the schema defines a different profile for search time](app/schemas/doc.sd) which does synonym expansion. So it will match "dubious" from the query string with "special" in the index:
54
+
55
+
```bash
56
+
curl -s -X POST -d '{
57
+
"yql":"select * from sources * where description contains \"dubious\"",
`model.type.profile` defines the profile to use for parsing the query string. This will match "dubious" with "special" (our test synonym expansion) even for the `title` field (which is bound to the `lowerFolding` profile which doesn't do synonym expansion):
For the `description` field, we already use a different profile for search time which already does synonym expansion (as defined in [the schema](app/schemas/doc.sd)). So it will match "dubious" with "special" out of the box:
76
+
### Force a different profile for a specific query clause
77
+
78
+
This works with `userInput()` and the `grammar.profile` annotation:
61
79
62
80
```bash
63
81
curl -s -X POST -d '{
64
-
"yql":"select * from sources * where description contains \"dubious\"",
82
+
"yql":"select * from sources * where where {defaultIndex:'title', grammar.profile: 'lowerFoldingStemmingSynonyms', grammar:'linguistics'}userInput('dubious')",
**NOTE**: The `grammar: 'linguistics'` annotation isn't required in this case, but makes sure that no additional parsing (besides the defined profile) is done. This is useful, for example, with collapsing synonyms (e.g., `wi fi => wifi`). Otherwise, the query becomes `["wi", "fi"]` along the way.
0 commit comments