Bug 1172107 - Document custom fields indexing
Summary: Document custom fields indexing
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Data Grid 6
Classification: JBoss
Component: Documentation
Version: 6.4.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: GA
: 6.4.0
Assignee: Misha H. Ali
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-09 12:18 UTC by Radim Vansa
Modified: 2015-01-27 23:44 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-01-27 23:44:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker ISPN-3718 0 Major Resolved Select which protobuf fields to index 2017-03-08 21:20:42 UTC

Description Radim Vansa 2014-12-09 12:18:34 UTC
There's no community docs yet, but we need to document the options for per-field indexing.

Comment 3 Radim Vansa 2014-12-10 15:28:47 UTC
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.

Comment 4 Misha H. Ali 2015-01-08 07:39:25 UTC
Hi Adrian,

Do we have any information about this yet for 6.4?

Comment 5 Adrian Nistor 2015-01-14 12:03:07 UTC
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

Comment 6 Radim Vansa 2015-01-14 12:51:24 UTC
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?

Comment 7 Adrian Nistor 2015-01-14 13:28:51 UTC
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.

Comment 9 Adrian Nistor 2015-01-20 02:32:13 UTC
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

Comment 11 Martin Gencur 2015-01-20 09:56:26 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.