[ckan-dev] ckanext-scheming
Armin Retterath
armin.retterath at gmail.com
Tue Jan 31 15:05:10 UTC 2017
hi together,
i solved the problems by creating a simple extension (i will expose it
later) for translating the titles of by use a central schema and give the
possibility to choose a special schema when creating a new package.
following steps are needed.
1. define your own schemes with different dataset-type identifiers/names
2. for the translation add s.th. like
"dataset_type_label":
{
"en": "govdata json 1.0 template",
"de": "GovData OpenData Datensatz"
}
3. define a central schema with a special dataset-type "dataset", this is
only used for the translation of the classifications and holds all
classifications of all dataset-types
4. adopt the templates: organization/read.html, package/search.html,
snippets/facet_list.html, search_form.html, user/dashboard_dataset.html
all other things are done by simply defining json schemas and usage of
ckanext-scheming ;-)
the main problem for me, was to understand how the solr index is connected
to the database/scheming elements.
you have to adopt the schema.xml for multi select elements and you have to
know, that all resource extra elements are automatically extracted as
res_extras_{name of your custom resource attribute}. conventionally
choosing the a name like "res_..." for custom resource attributes, the
index field would become "res_extras_res..." . If you have a single choice
(multiValued=false) element defined in one of your schemes, you have to
define a new line like
<field name="res_extras_res_transparency_document_change_classification"
type="string" indexed="true" stored="true" multiValued="false"/>
before the default extraction handlers:
<dynamicField name="extras_*" type="text" indexed="true" stored="true"
multiValued="false"/>
<dynamicField name="res_extras_*" type="text" indexed="true" stored="true"
multiValued="true"/>
hope this may hep someone to use ckanext-scheming to built up transparency
portals which not only serve data but also documents with special
classifications ;-)
best regards from germany and many thanx for the support
armin
2016-12-08 15:27 GMT+01:00 Armin Retterath <armin.retterath at gmail.com>:
> hi ian,
>
> thanx for the information. i will deactivate the facet for the first time
> and will look at the problem when i get some time later on ;-) .
>
> armin
>
> 2016-12-08 14:54 GMT+01:00 Ian Ward <ian at excess.org>:
>
>> Facet interfaces aren't generated for you by Scheming (yet) For now
>> you'll need to override your templates to get the display you're
>> looking for, or if you'd like, help contribute that as a new feature.
>>
>> On Thu, Dec 8, 2016 at 8:36 AM, Armin Retterath
>> <armin.retterath at gmail.com> wrote:
>> > hello together,
>> >
>> > i tried to use a select option by using choices at resource level and
>> > altered the solr schema as it have to be done for package level
>> choices. the
>> > problem is, that the facet don't work as expected. the editor shows up
>> the
>> > select box and the value is stored, but neither the translation of the
>> facet
>> > title is done nor does the value show up in the filter :-( .
>> >
>> > snippet from json file:
>> > ...
>> > "resource_fields": [
>> > {
>> > "field_name": "res_transparency_document_change_classification",
>> > "preset": "select",
>> > "label": {
>> > "en": "Change classification",
>> > "de": "Änderungsstatus"
>> > },
>> > "choices": [
>> > {
>> > "value": "unaltered",
>> > "label": {
>> > "en": "unaltered",
>> > "de": "unverändert"
>> > }
>> > },
>> > {
>> > "value": "blackened",
>> > "label": {
>> > "en": "blackened",
>> > "de": "geschwärzt"
>> > }
>> > },
>> > {
>> > "value": "created_for_publication",
>> > "label": {
>> > "en": "created for publication",
>> > "de": "speziell für Publikation erstellt"
>> > }
>> > }
>> > ]
>> > },
>> > ...
>> >
>> > thanx in advance
>> >
>> > armin
>> >
>> > _______________________________________________
>> > ckan-dev mailing list
>> > ckan-dev at lists.okfn.org
>> > https://lists.okfn.org/mailman/listinfo/ckan-dev
>> > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>> >
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20170131/6c7a650e/attachment-0003.html>
More information about the ckan-dev
mailing list