[ 
https://issues.apache.org/jira/browse/OAK-9046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17096485#comment-17096485
 ] 

Thomas Mueller commented on OAK-9046:
-------------------------------------

For SQL-2, the function is called length(). for a relational database, it would 
be clear that this is the blob length (for a blob).

In xpath, there is no blob AFAIK, so the function is called string-length.

* http://jackrabbit.apache.org/oak/docs/query/grammar-sql2.html#dynamic_operand
* http://jackrabbit.apache.org/oak/docs/query/grammar-xpath.html#dynamic_operand

What we do currently is try to converting the binary to a string, then check 
the length... this fails for segment store, and would fail if the binary is 
large (e.g. 2 GB) due to out-of-memory.

I think it's fine to use length in number of bytes for binaries. Actually we do 
that when calculating the length() function for conditions in a query as well.

> Index function string-length should index size for binary properties
> --------------------------------------------------------------------
>
>                 Key: OAK-9046
>                 URL: https://issues.apache.org/jira/browse/OAK-9046
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: indexing
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Major
>
> For  index definition 
> {noformat}
> <size
>  jcr:primaryType="nt:unstructured"
>  ordered="{Boolean}true"
>  propertyIndex="{Boolean}true"
>  type="Long"
>  function="fn:string-length(jcr:content/@jcr:data)"/>
> {noformat}
> Expected result: Index the size of @jcr:data
> Current result: 
> {noformat}
>  ERROR o.a.j.o.p.i.l.LuceneDocumentMaker - Failed to calculate function value 
> for [function, length, @jcr:content/jcr:data] ...
> java.lang.IllegalStateException: String is too long: 2325601444581057974
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to