{"action":"created","comment":{"url":"https://api.github.com/repos/scireum/sirius-search/pulls/comments/127161112","pull_request_review_id":49714747,"id":127161112,"diff_hunk":"@@ -250,22 +450,46 @@ protected Object transformFromRequest(String name, WebContext ctx) {\n         return result;\n     }\n \n-    /**\n-     * Provides access to the underlying java field\n-     *\n-     * @return the field upon which the property was created\n-     */\n-    public Field getField() {\n-        return field;\n+    protected <T extends Annotation> ESOption readAnnotationValue(Class<T> annotation,\n+                                                                  Function<T, ESOption> annotationField,\n+                                                                  Supplier<ESOption> defaultSupplier) {\n+        if (!field.isAnnotationPresent(annotation)) {\n+            return defaultSupplier.get();\n+        }\n+        ESOption value = annotationField.apply(field.getAnnotation(annotation));\n+        return value == DEFAULT ? defaultSupplier.get() : value;\n     }\n \n     /**\n-     * Returns a translated title for the property by resolving\n-     * <tt>SimpleClassName.fieldName</tt> via {@link sirius.kernel.nls.NLS}.\n+     * Creates mappings for inner fields in \"nested\" or \"object\" types\n      *\n-     * @return the translated name or label for this property.\n+     * @param builder     output\n+     * @param nestedClass model class that is used as nested object\n+     * @throws IOException\n      */\n-    public String getFieldTitle() {\n-        return NLS.get(field.getDeclaringClass().getSimpleName() + \".\" + getName());\n+    protected void addNestedMappingProperties(XContentBuilder builder, Class<?> nestedClass) throws IOException {\n+        if (nestedClass.isAnnotationPresent(Indexed.class)) {\n+            for (Property property : new EntityDescriptor(nestedClass).getProperties()) {\n+                builder.startObject(property.getName());\n+                property.addMappingProperties(builder);\n+                builder.endObject();\n+            }\n+        } else {\n+            for (Field innerField : nestedClass.getDeclaredFields()) {\n+                if (!innerField.isAnnotationPresent(Transient.class) && !Modifier.isStatic(innerField.getModifiers())) {\n+                    for (PropertyFactory f : Injector.context().getPartCollection(PropertyFactory.class)) {\n+                        if (f.accepts(innerField)) {\n+                            Property p = f.create(innerField);\n+                            p.setInnerProperty(true);\n+                            p.createMapping(builder);\n+                            continue;","path":"src/main/java/sirius/search/properties/Property.java","position":435,"original_position":435,"commit_id":"24e7468eb8964915f9c3561e3ab5d6945cde95b2","original_commit_id":"24e7468eb8964915f9c3561e3ab5d6945cde95b2","user":{"login":"D3nnisH","id":7695721,"avatar_url":"https://avatars2.githubusercontent.com/u/7695721?v=3","gravatar_id":"","url":"https://api.github.com/users/D3nnisH","html_url":"https://github.com/D3nnisH","followers_url":"https://api.github.com/users/D3nnisH/followers","following_url":"https://api.github.com/users/D3nnisH/following{/other_user}","gists_url":"https://api.github.com/users/D3nnisH/gists{/gist_id}","starred_url":"https://api.github.com/users/D3nnisH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/D3nnisH/subscriptions","organizations_url":"https://api.github.com/users/D3nnisH/orgs","repos_url":"https://api.github.com/users/D3nnisH/repos","events_url":"https://api.github.com/users/D3nnisH/events{/privacy}","received_events_url":"https://api.github.com/users/D3nnisH/received_events","type":"User","site_admin":false},"body":"should have been `break;` 😅 ","created_at":"2017-07-13T08:47:55Z","updated_at":"2017-07-13T08:47:55Z","html_url":"https://github.com/scireum/sirius-search/pull/105#discussion_r127161112","pull_request_url":"https://api.github.com/repos/scireum/sirius-search/pulls/105","_links":{"self":{"href":"https://api.github.com/repos/scireum/sirius-search/pulls/comments/127161112"},"html":{"href":"https://github.com/scireum/sirius-search/pull/105#discussion_r127161112"},"pull_request":{"href":"https://api.github.com/repos/scireum/sirius-search/pulls/105"}}},"pull_request":{"url":"https://api.github.com/repos/scireum/sirius-search/pulls/105","id":130123595,"html_url":"https://github.com/scireum/sirius-search/pull/105","diff_url":"https://github.com/scireum/sirius-search/pull/105.diff","patch_url":"https://github.com/scireum/sirius-search/pull/105.patch","issue_url":"https://api.github.com/repos/scireum/sirius-search/issues/105","number":105,"state":"open","locked":false,"title":"Improves Mapping generation and annotations for Entity fields + Bugfixing","user":{"login":"D3nnisH","id":7695721,"avatar_url":"https://avatars2.githubusercontent.com/u/7695721?v=3","gravatar_id":"","url":"https://api.github.com/users/D3nnisH","html_url":"https://github.com/D3nnisH","followers_url":"https://api.github.com/users/D3nnisH/followers","following_url":"https://api.github.com/users/D3nnisH/following{/other_user}","gists_url":"https://api.github.com/users/D3nnisH/gists{/gist_id}","starred_url":"https://api.github.com/users/D3nnisH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/D3nnisH/subscriptions","organizations_url":"https://api.github.com/users/D3nnisH/orgs","repos_url":"https://api.github.com/users/D3nnisH/repos","events_url":"https://api.github.com/users/D3nnisH/events{/privacy}","received_events_url":"https://api.github.com/users/D3nnisH/received_events","type":"User","site_admin":false},"body":"## Annotations\r\n\r\nBefore | After\r\n-------|------\r\n`@IndexMode(includeInAll = false)` | `@IndexMode(includeInAll = ESOption.FALSE)`\r\n`@IndexMode(normEnabled = false)` | `@IndexMode(normsEnabled = ESOption.FALSE)`\r\n`@IndexMode(indexOptions = IndexMode.INDEX_OPTION_FREQS)` | `@Analyzed(indexOptions = Analyzed.INDEX_OPTION_FREQS)`\r\n`@IndexMode(analyzer = IndexMode.ANALYZER_WHITESPACE)` | `@Analyzed(analyzer = Analyzed.ANALYZER_WHITESPACE)`\r\n`@IndexMode(indexMode = IndexMode.MODE_NO)` | `@IndexMode(indexed = ESOption.FALSE)`\r\n`@IndexMode(indexMode = IndexMode.MODE_NOT_ANALYZED)` | *is the default value*\r\n`@IndexMode(indexMode = IndexMode.MODE_ANALYZE)` | `@Analyzed`\r\n`@Stored` | `@IndexMode(stored = ESOption.TRUE)`\r\n\r\n`@Analyzed` makes only sense for fields of type `String`, `List<String>` or `AutoComplete`. \r\n\r\n`@IndexMode.normsEnabled` makes only sense for fields of type `String` or `List<String>`.\r\n\r\n`@IndexMode.docValues` makes no sense for fields of type `String` or `List<String>` that are analyzed.\r\n\r\n\r\n## Default values (almost the same as before):\r\nOption | Value\r\n-------|------\r\n**include_in_all** | `true` for `String` and `List<String>`, `false` otherwise\r\n**norms_enabled** | elasticsearch default (`true` for analyzed fields, `false` otherwise)\r\n**indexed** | `true` (formerly `MODE_NOT_ANALYZED` which means the same)\r\n**stored** | `false` (formerly `true` due to a bug)\r\n**analyzed** | disabled (formerly `MODE_NOT_ANALYZED` which means the same)\r\n**analyzer** | `whitespace` for `AutoComplete`, elasticsearch default (global configured analyzer) otherwise\r\n**index_options** | elasticsearch default (`positions` for analyzed fields, and to `docs` for not_analyzed fields)\r\n**doc_values** (NEW!) | `false` if **indexed** is `false`, elasticsearch default (`true`) otherwise\r\n\r\n\r\n\r\n## The `ESOption` enum\r\n\r\nThe purpose of the `ESOption` enum is to handle the appliance of default values. When using primitive `boolean`s as values in the annotations' fields, one could not distinguish between purposely set values and annotation default values. This is because an annotation always has values for all properties it declares, not only those that were set in the usage. Furthermore, `null` is not allowed as default value in an annotation. This wouldn't be a problem, if not some subclasses of `Property` wanted to use differing default values (for example for `include_in_all`).\r\n\r\nTo solve this dilemma, we use `ESOption`, which has 4 possible values instead of 2.\r\n- `TRUE`: use `true`\r\n- `FALSE`: use `false`\r\n- `ES_DEFAULT`: use the default value of elasticsearch by not sending the option at all\r\n- `DEFAULT`: use the default value of sirius-search as defined in the specific subclass of `Property` (may be one of the 3 above)","created_at":"2017-07-12T12:13:56Z","updated_at":"2017-07-13T08:47:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"648be31357432ea634dba803d3b042791d7640be","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/scireum/sirius-search/pulls/105/commits","review_comments_url":"https://api.github.com/repos/scireum/sirius-search/pulls/105/comments","review_comment_url":"https://api.github.com/repos/scireum/sirius-search/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scireum/sirius-search/issues/105/comments","statuses_url":"https://api.github.com/repos/scireum/sirius-search/statuses/24e7468eb8964915f9c3561e3ab5d6945cde95b2","head":{"label":"scireum:properties-and-indexmodes","ref":"properties-and-indexmodes","sha":"24e7468eb8964915f9c3561e3ab5d6945cde95b2","user":{"login":"scireum","id":5050602,"avatar_url":"https://avatars3.githubusercontent.com/u/5050602?v=3","gravatar_id":"","url":"https://api.github.com/users/scireum","html_url":"https://github.com/scireum","followers_url":"https://api.github.com/users/scireum/followers","following_url":"https://api.github.com/users/scireum/following{/other_user}","gists_url":"https://api.github.com/users/scireum/gists{/gist_id}","starred_url":"https://api.github.com/users/scireum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scireum/subscriptions","organizations_url":"https://api.github.com/users/scireum/orgs","repos_url":"https://api.github.com/users/scireum/repos","events_url":"https://api.github.com/users/scireum/events{/privacy}","received_events_url":"https://api.github.com/users/scireum/received_events","type":"Organization","site_admin":false},"repo":{"id":27233310,"name":"sirius-search","full_name":"scireum/sirius-search","owner":{"login":"scireum","id":5050602,"avatar_url":"https://avatars3.githubusercontent.com/u/5050602?v=3","gravatar_id":"","url":"https://api.github.com/users/scireum","html_url":"https://github.com/scireum","followers_url":"https://api.github.com/users/scireum/followers","following_url":"https://api.github.com/users/scireum/following{/other_user}","gists_url":"https://api.github.com/users/scireum/gists{/gist_id}","starred_url":"https://api.github.com/users/scireum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scireum/subscriptions","organizations_url":"https://api.github.com/users/scireum/orgs","repos_url":"https://api.github.com/users/scireum/repos","events_url":"https://api.github.com/users/scireum/events{/privacy}","received_events_url":"https://api.github.com/users/scireum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scireum/sirius-search","description":"Provides a thin layer above Elasticsearch (Fluent Query API, Automatic Mapping, Utilities)","fork":false,"url":"https://api.github.com/repos/scireum/sirius-search","forks_url":"https://api.github.com/repos/scireum/sirius-search/forks","keys_url":"https://api.github.com/repos/scireum/sirius-search/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scireum/sirius-search/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scireum/sirius-search/teams","hooks_url":"https://api.github.com/repos/scireum/sirius-search/hooks","issue_events_url":"https://api.github.com/repos/scireum/sirius-search/issues/events{/number}","events_url":"https://api.github.com/repos/scireum/sirius-search/events","assignees_url":"https://api.github.com/repos/scireum/sirius-search/assignees{/user}","branches_url":"https://api.github.com/repos/scireum/sirius-search/branches{/branch}","tags_url":"https://api.github.com/repos/scireum/sirius-search/tags","blobs_url":"https://api.github.com/repos/scireum/sirius-search/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scireum/sirius-search/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scireum/sirius-search/git/refs{/sha}","trees_url":"https://api.github.com/repos/scireum/sirius-search/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scireum/sirius-search/statuses/{sha}","languages_url":"https://api.github.com/repos/scireum/sirius-search/languages","stargazers_url":"https://api.github.com/repos/scireum/sirius-search/stargazers","contributors_url":"https://api.github.com/repos/scireum/sirius-search/contributors","subscribers_url":"https://api.github.com/repos/scireum/sirius-search/subscribers","subscription_url":"https://api.github.com/repos/scireum/sirius-search/subscription","commits_url":"https://api.github.com/repos/scireum/sirius-search/commits{/sha}","git_commits_url":"https://api.github.com/repos/scireum/sirius-search/git/commits{/sha}","comments_url":"https://api.github.com/repos/scireum/sirius-search/comments{/number}","issue_comment_url":"https://api.github.com/repos/scireum/sirius-search/issues/comments{/number}","contents_url":"https://api.github.com/repos/scireum/sirius-search/contents/{+path}","compare_url":"https://api.github.com/repos/scireum/sirius-search/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scireum/sirius-search/merges","archive_url":"https://api.github.com/repos/scireum/sirius-search/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scireum/sirius-search/downloads","issues_url":"https://api.github.com/repos/scireum/sirius-search/issues{/number}","pulls_url":"https://api.github.com/repos/scireum/sirius-search/pulls{/number}","milestones_url":"https://api.github.com/repos/scireum/sirius-search/milestones{/number}","notifications_url":"https://api.github.com/repos/scireum/sirius-search/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scireum/sirius-search/labels{/name}","releases_url":"https://api.github.com/repos/scireum/sirius-search/releases{/id}","deployments_url":"https://api.github.com/repos/scireum/sirius-search/deployments","created_at":"2014-11-27T16:28:23Z","updated_at":"2017-07-05T08:21:12Z","pushed_at":"2017-07-12T17:13:23Z","git_url":"git://github.com/scireum/sirius-search.git","ssh_url":"git@github.com:scireum/sirius-search.git","clone_url":"https://github.com/scireum/sirius-search.git","svn_url":"https://github.com/scireum/sirius-search","homepage":"http://sirius-lib.net","size":1322,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":2,"forks":5,"open_issues":2,"watchers":5,"default_branch":"master"}},"base":{"label":"scireum:master","ref":"master","sha":"10b9e5c2320a75575c79f842719d7c7c390cb843","user":{"login":"scireum","id":5050602,"avatar_url":"https://avatars3.githubusercontent.com/u/5050602?v=3","gravatar_id":"","url":"https://api.github.com/users/scireum","html_url":"https://github.com/scireum","followers_url":"https://api.github.com/users/scireum/followers","following_url":"https://api.github.com/users/scireum/following{/other_user}","gists_url":"https://api.github.com/users/scireum/gists{/gist_id}","starred_url":"https://api.github.com/users/scireum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scireum/subscriptions","organizations_url":"https://api.github.com/users/scireum/orgs","repos_url":"https://api.github.com/users/scireum/repos","events_url":"https://api.github.com/users/scireum/events{/privacy}","received_events_url":"https://api.github.com/users/scireum/received_events","type":"Organization","site_admin":false},"repo":{"id":27233310,"name":"sirius-search","full_name":"scireum/sirius-search","owner":{"login":"scireum","id":5050602,"avatar_url":"https://avatars3.githubusercontent.com/u/5050602?v=3","gravatar_id":"","url":"https://api.github.com/users/scireum","html_url":"https://github.com/scireum","followers_url":"https://api.github.com/users/scireum/followers","following_url":"https://api.github.com/users/scireum/following{/other_user}","gists_url":"https://api.github.com/users/scireum/gists{/gist_id}","starred_url":"https://api.github.com/users/scireum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scireum/subscriptions","organizations_url":"https://api.github.com/users/scireum/orgs","repos_url":"https://api.github.com/users/scireum/repos","events_url":"https://api.github.com/users/scireum/events{/privacy}","received_events_url":"https://api.github.com/users/scireum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scireum/sirius-search","description":"Provides a thin layer above Elasticsearch (Fluent Query API, Automatic Mapping, Utilities)","fork":false,"url":"https://api.github.com/repos/scireum/sirius-search","forks_url":"https://api.github.com/repos/scireum/sirius-search/forks","keys_url":"https://api.github.com/repos/scireum/sirius-search/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scireum/sirius-search/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scireum/sirius-search/teams","hooks_url":"https://api.github.com/repos/scireum/sirius-search/hooks","issue_events_url":"https://api.github.com/repos/scireum/sirius-search/issues/events{/number}","events_url":"https://api.github.com/repos/scireum/sirius-search/events","assignees_url":"https://api.github.com/repos/scireum/sirius-search/assignees{/user}","branches_url":"https://api.github.com/repos/scireum/sirius-search/branches{/branch}","tags_url":"https://api.github.com/repos/scireum/sirius-search/tags","blobs_url":"https://api.github.com/repos/scireum/sirius-search/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scireum/sirius-search/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scireum/sirius-search/git/refs{/sha}","trees_url":"https://api.github.com/repos/scireum/sirius-search/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scireum/sirius-search/statuses/{sha}","languages_url":"https://api.github.com/repos/scireum/sirius-search/languages","stargazers_url":"https://api.github.com/repos/scireum/sirius-search/stargazers","contributors_url":"https://api.github.com/repos/scireum/sirius-search/contributors","subscribers_url":"https://api.github.com/repos/scireum/sirius-search/subscribers","subscription_url":"https://api.github.com/repos/scireum/sirius-search/subscription","commits_url":"https://api.github.com/repos/scireum/sirius-search/commits{/sha}","git_commits_url":"https://api.github.com/repos/scireum/sirius-search/git/commits{/sha}","comments_url":"https://api.github.com/repos/scireum/sirius-search/comments{/number}","issue_comment_url":"https://api.github.com/repos/scireum/sirius-search/issues/comments{/number}","contents_url":"https://api.github.com/repos/scireum/sirius-search/contents/{+path}","compare_url":"https://api.github.com/repos/scireum/sirius-search/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scireum/sirius-search/merges","archive_url":"https://api.github.com/repos/scireum/sirius-search/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scireum/sirius-search/downloads","issues_url":"https://api.github.com/repos/scireum/sirius-search/issues{/number}","pulls_url":"https://api.github.com/repos/scireum/sirius-search/pulls{/number}","milestones_url":"https://api.github.com/repos/scireum/sirius-search/milestones{/number}","notifications_url":"https://api.github.com/repos/scireum/sirius-search/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scireum/sirius-search/labels{/name}","releases_url":"https://api.github.com/repos/scireum/sirius-search/releases{/id}","deployments_url":"https://api.github.com/repos/scireum/sirius-search/deployments","created_at":"2014-11-27T16:28:23Z","updated_at":"2017-07-05T08:21:12Z","pushed_at":"2017-07-12T17:13:23Z","git_url":"git://github.com/scireum/sirius-search.git","ssh_url":"git@github.com:scireum/sirius-search.git","clone_url":"https://github.com/scireum/sirius-search.git","svn_url":"https://github.com/scireum/sirius-search","homepage":"http://sirius-lib.net","size":1322,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":2,"forks":5,"open_issues":2,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scireum/sirius-search/pulls/105"},"html":{"href":"https://github.com/scireum/sirius-search/pull/105"},"issue":{"href":"https://api.github.com/repos/scireum/sirius-search/issues/105"},"comments":{"href":"https://api.github.com/repos/scireum/sirius-search/issues/105/comments"},"review_comments":{"href":"https://api.github.com/repos/scireum/sirius-search/pulls/105/comments"},"review_comment":{"href":"https://api.github.com/repos/scireum/sirius-search/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scireum/sirius-search/pulls/105/commits"},"statuses":{"href":"https://api.github.com/repos/scireum/sirius-search/statuses/24e7468eb8964915f9c3561e3ab5d6945cde95b2"}}}}
{"actor":{"display_login":"D3nnisH"}}