There's no community docs yet, but we need to document the options for per-field indexing.
No, as I've said, no community docs. I've asked Adrian Nistor to provide this info in PR comments https://github.com/infinispan/infinispan/pull/2987 Since I would have to seek that info from sources/tests too, please ask Adrian for the details. I can only check if I find such info complete enough.
Hi Adrian, Do we have any information about this yet for 6.4?
Hi Misha, here is the doc text I want to add to the community docs for this feature: ---- BEGIN DOC ---- All fields of Protobuf types are indexed and stored by default. This behaviour is usually acceptable in most cases but it can become a performace problem if there are many or very large fields. To avoid such problems JDG allows you to specify which fields to index and store by means of two annotations (@Indexed and @IndexedField) that can be added directly to your Protobuf schema in the documentation comments of mesage type definitions and field definitions as demonstrated in the example below: Example /* This type is indexed, but not all its fields are. @Indexed */ message Note { /* This field is indexed but not stored. It can be used for querying but not for projections. @IndexedField(index=true, store=false) */ optional string text = 1; /* A field that is both indexed and stored. @IndexedField */ optional string author = 2; /* @IndexedField(index=false, store=true) */ optional bool isRead = 3; /* This field is not annotated, so it is neither indexed nor stored. */ optional int32 priority; } Documentation annotations can be added on the last line of the documentation comment that precedes the element to be annotated (message type definition or field definition). The '@Indexed' annotation applies to message types only, has a boolean value and it defaults to 'true', so '@Indexed' is equivalent to '@Indexed(true)'. The presence of this annotation indicates the intention to selectively specify which of the fields of this message type are to be indexed. '@Indexed(false)' indicates that no fields will be indexed anyway, so the eventual '@IndexedField' annotations present at field level will be ignored. The '@IndexedField' annotation applies to fields only and has two boolean attributes, 'index' and 'store', which default to true (@IndexedField is equivalent to @IndexedField(index=true, store=true)). The 'index' attribute indicates whether the field will be indexed, so it can be used for indexed queries, while the 'store' attribute indicates whether the field value is to be stored in the index too, so it becomes useable for projections. NOTE: The @IndexedField annotation has effect only if the containing message type was annotated as '@Indexed'. ---- END DOC ---- Until the community docs get updated please try to use this. Thanks, Adrian
Hi Adrian, could you also specify how does this work with https://bugzilla.redhat.com/show_bug.cgi?id=1172646 and provide any information about the above?
I do not think that piece of information belongs in this section of the user guide. It should be in the (now-being-written) section that covers the protobuf annotations. But, in one sentence: there is an optional @ProtoDoc annotation that is used to provide the documentation comment of the message type or field of the generated schema and this can be used to inject @Indexed and @IndexedField annotations in the generated *.proto where needed.
Hi Misha, some small changes are needed: 1. misspelled 'applued' 2. replace Example 7.7. Example of Indexing Using Protobuf Example 7.7. Specifying which fields are indexed 3. replace @Indexed equals @Indexed(true) with @Indexed is equivalent to @Indexed(true) 4. replace @IndexedField equals @IndexedField(index=true, store=true) with @IndexedField is equivalent to @IndexedField(index=true, store=true) 5. replace The @IndexedField is only effective if the message .... with The @IndexedField annotation is only effective if the message .... 6. Please remove this text (this does not belong here, will be included in the section created by Bobb). "Additionally, an optional @ProtoDoc annotation is available to inject the @Indexed and @IndexedField annotations in the generated *.proto file where needed. The @ProtoDoc annotation is added to the documentation comment of the message type or field of the generated schema." Adrian
I only checked chapter 7.3.6 and my findings: The @Indexed annotation only applied to message types --> The @Indexed annotation only applies to message types Otherwise it looks good to me.