You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Nazerke S <sn...@gmail.com> on 2019/05/10 15:08:33 UTC

Streaming Expression: get the value of the array at the specified position

Hi,

I am interested in getting the value of the array at the given index. For
example,

let(echo="b", a=array(1,2,3,4,5), b=getAt(a, 2))  should return 3.

Is there a way to get access an array's element by indexing?

Thanks!

__Nazerke

Re: Streaming Expression: get the value of the array at the specified position

Posted by Nazerke S <sn...@gmail.com>.
That was really helpful for my use case.

It should definitely be included in the documentation.

On Sat, May 11, 2019 at 8:19 PM Joel Bernstein <jo...@gmail.com> wrote:

> There actually is an undocumented function called valueAt. It works both
> for an array and for a matrix.
>
> For an array:
>
> let(echo="b", a=array(1,2,3,4,5), b=valueAt(a, 2))  should return 3.
>
> I have lot's of documentation still to do.
>
>
>
>
>
>
>
>
>
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
>
> On Fri, May 10, 2019 at 11:12 AM David Hastings <
> hastings.recursive@gmail.com> wrote:
>
> > no.
> >
> > On Fri, May 10, 2019 at 11:09 AM Nazerke S <sn...@gmail.com>
> wrote:
> >
> > > Hi,
> > >
> > > I am interested in getting the value of the array at the given index.
> For
> > > example,
> > >
> > > let(echo="b", a=array(1,2,3,4,5), b=getAt(a, 2))  should return 3.
> > >
> > > Is there a way to get access an array's element by indexing?
> > >
> > > Thanks!
> > >
> > > __Nazerke
> > >
> >
>

Re: Streaming Expression: get the value of the array at the specified position

Posted by Joel Bernstein <jo...@gmail.com>.
There actually is an undocumented function called valueAt. It works both
for an array and for a matrix.

For an array:

let(echo="b", a=array(1,2,3,4,5), b=valueAt(a, 2))  should return 3.

I have lot's of documentation still to do.










Joel Bernstein
http://joelsolr.blogspot.com/


On Fri, May 10, 2019 at 11:12 AM David Hastings <
hastings.recursive@gmail.com> wrote:

> no.
>
> On Fri, May 10, 2019 at 11:09 AM Nazerke S <sn...@gmail.com> wrote:
>
> > Hi,
> >
> > I am interested in getting the value of the array at the given index. For
> > example,
> >
> > let(echo="b", a=array(1,2,3,4,5), b=getAt(a, 2))  should return 3.
> >
> > Is there a way to get access an array's element by indexing?
> >
> > Thanks!
> >
> > __Nazerke
> >
>

Re: Streaming Expression: get the value of the array at the specified position

Posted by David Hastings <ha...@gmail.com>.
no.

On Fri, May 10, 2019 at 11:09 AM Nazerke S <sn...@gmail.com> wrote:

> Hi,
>
> I am interested in getting the value of the array at the given index. For
> example,
>
> let(echo="b", a=array(1,2,3,4,5), b=getAt(a, 2))  should return 3.
>
> Is there a way to get access an array's element by indexing?
>
> Thanks!
>
> __Nazerke
>