|
9 | 9 |
|
10 | 10 | (custom-search-label)= |
11 | 11 |
|
12 | | -# Custom Search |
| 12 | +# Custom search |
13 | 13 |
|
14 | 14 | Volto has a search block that allows you to build custom searches without additional add-ons. |
15 | 15 |
|
| 16 | +````{card} Backend chapter |
| 17 | +
|
| 18 | +Check out `mastering-plone-project` at tag `vocabularies`: |
| 19 | +
|
| 20 | +```shell |
| 21 | +git checkout vocabularies |
| 22 | +``` |
| 23 | +
|
| 24 | +The code at the end of the chapter: |
| 25 | +
|
| 26 | +```shell |
| 27 | +git checkout search |
| 28 | +``` |
| 29 | +
|
| 30 | +More info in {doc}`code` |
| 31 | +```` |
| 32 | + |
| 33 | + |
16 | 34 | ## Exercise |
17 | 35 |
|
18 | 36 | Show talks on the talks page with a search block. |
@@ -44,32 +62,39 @@ Check the entries by switching to the "Browse" tab. |
44 | 62 | :animate: fade-in-slide-down |
45 | 63 | :icon: question |
46 | 64 |
|
47 | | -{file}`catalog.xml` |
| 65 | +{file}`backend/src/ploneconf/site/profiles/default/catalog.xml` |
48 | 66 | ```xml |
49 | 67 |
|
50 | | - <index name="type_of_talk" meta_type="KeywordIndex"> |
51 | | - <indexed_attr value="type_of_talk"/> |
| 68 | + <index meta_type="KeywordIndex" |
| 69 | + name="type_of_talk" |
| 70 | + > |
| 71 | + <indexed_attr value="type_of_talk" /> |
52 | 72 | </index> |
53 | | - <column value="type_of_talk"/> |
| 73 | + <column value="type_of_talk" /> |
54 | 74 | ``` |
55 | 75 |
|
56 | | -{file}`querystring.xml` |
| 76 | +{file}`backend/src/ploneconf/site/profiles/default/querystring.xml` |
57 | 77 | ```xml |
58 | 78 |
|
59 | 79 | <records interface="plone.app.querystring.interfaces.IQueryField" |
60 | | - prefix="plone.app.querystring.field.type_of_talk"> |
61 | | - <value key="title" i18n:translate="">Type of Talk</value> |
62 | | - <value key="enabled">True</value> |
63 | | - <value key="sortable">False</value> |
64 | | - <value key="operations"> |
65 | | - <element>plone.app.querystring.operation.selection.any</element> |
66 | | - <element>plone.app.querystring.operation.selection.all</element> |
67 | | - <element>plone.app.querystring.operation.selection.none</element> |
68 | | - </value> |
69 | | - <value key="group" i18n:translate="">Metadata</value> |
70 | | - <value key="vocabulary">ploneconf.types_of_talk</value> |
| 80 | + prefix="plone.app.querystring.field.type_of_talk" |
| 81 | + > |
| 82 | + <value key="title" |
| 83 | + i18n:translate="" |
| 84 | + >Type of Talk</value> |
| 85 | + <value key="enabled">True</value> |
| 86 | + <value key="sortable">False</value> |
| 87 | + <value key="operations"> |
| 88 | + <element>plone.app.querystring.operation.selection.any</element> |
| 89 | + <element>plone.app.querystring.operation.selection.all</element> |
| 90 | + <element>plone.app.querystring.operation.selection.none</element> |
| 91 | + </value> |
| 92 | + <value key="group" |
| 93 | + i18n:translate="" |
| 94 | + >Metadata</value> |
| 95 | + <value key="vocabulary">ploneconf.types_of_talk</value> |
71 | 96 | </records> |
72 | 97 | ``` |
73 | 98 |
|
74 | | -Checkout `ploneconf.site` at tag "search" to see the updated code. |
| 99 | +Check out `mastering-plone-project` at tag `search` to see the updated code. |
75 | 100 | ```` |
0 commit comments