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 "Yubing Dong 董玉冰 (Tom)" <to...@gmail.com> on 2014/11/04 05:18:32 UTC

Faceting return value of a function query?

Hi,

I'm new to Solr, and I'm having a problem with faceting. I would really
appreciate it if you could help :)

I have a set of documents in JSON format, which I could post to my Solr
core using the post.jar tool. Each document contains two fields, namely
"startDate" and "endDate", both of which are of type "date".

Conceptually, I would like to have a third field "timeSpan" that is
automatically generated from the return value of function query
"ms(endDate, startDate)", and do range facet on it, i.e. compute the
distribution of "timeSpan", among either all of or a filtered subset of the
documents.

I have tried to find ways of both directly faceting the function return
values and automatically generate the "timeSpan" field during indexing, but
without luck yet.

Suggestions are greatly appreciated!

Best,
Yubing

Re: Faceting return value of a function query?

Posted by "Yubing Dong 董玉冰 (Tom)" <to...@gmail.com>.
Turns out that update processors perfectly suit me needs. I ended up using
the StatelessScriptUpdateProcessor with a simple js script :-)

On Mon Nov 03 2014 at 下午10:40:52 Yubing (Tom) Dong 董玉冰 <
tom.tung.dyb@gmail.com> wrote:

> I see. Thank you! :-)
>
> Sent from my Android phone
> On Nov 3, 2014 9:35 PM, "Erick Erickson" <er...@gmail.com> wrote:
>
>> Yep. It's almost always easier and faster if you can pre-compute as
>> much as possible during indexing time. It'll take longer to   index of
>> course, but the ratio of writing to the index to searching is usually
>> hugely in favor of doing the work during indexing.
>>
>> Best,
>> Erick
>>
>> On Mon, Nov 3, 2014 at 8:52 PM, Yubing (Tom) Dong 董玉冰
>> <to...@gmail.com> wrote:
>> > Hi Erik,
>> >
>> > Thanks for the reply! Do you mean parse and modify the documents before
>> > sending them to Solr?
>> >
>> > Cheers,
>> > Yubing
>> >
>> > On Mon, Nov 3, 2014 at 8:48 PM, Erick Erickson <erickerickson@gmail.com
>> >
>> > wrote:
>> >
>> >> Wouldn't it be easiest to compute the span at index time? Then it's
>> >> very straight-forward.
>> >>
>> >> Best,
>> >> Erick
>> >>
>> >> On Mon, Nov 3, 2014 at 8:18 PM, Yubing (Tom) Dong 董玉冰
>> >> <to...@gmail.com> wrote:
>> >> > Hi,
>> >> >
>> >> > I'm new to Solr, and I'm having a problem with faceting. I would
>> really
>> >> > appreciate it if you could help :)
>> >> >
>> >> > I have a set of documents in JSON format, which I could post to my
>> Solr
>> >> > core using the post.jar tool. Each document contains two fields,
>> namely
>> >> > "startDate" and "endDate", both of which are of type "date".
>> >> >
>> >> > Conceptually, I would like to have a third field "timeSpan" that is
>> >> > automatically generated from the return value of function query
>> >> > "ms(endDate, startDate)", and do range facet on it, i.e. compute the
>> >> > distribution of "timeSpan", among either all of or a filtered subset
>> of
>> >> the
>> >> > documents.
>> >> >
>> >> > I have tried to find ways of both directly faceting the function
>> return
>> >> > values and automatically generate the "timeSpan" field during
>> indexing,
>> >> but
>> >> > without luck yet.
>> >> >
>> >> > Suggestions are greatly appreciated!
>> >> >
>> >> > Best,
>> >> > Yubing
>> >>
>>
>

Re: Faceting return value of a function query?

Posted by "Yubing Dong 董玉冰 (Tom)" <to...@gmail.com>.
I see. Thank you! :-)

Sent from my Android phone
On Nov 3, 2014 9:35 PM, "Erick Erickson" <er...@gmail.com> wrote:

> Yep. It's almost always easier and faster if you can pre-compute as
> much as possible during indexing time. It'll take longer to   index of
> course, but the ratio of writing to the index to searching is usually
> hugely in favor of doing the work during indexing.
>
> Best,
> Erick
>
> On Mon, Nov 3, 2014 at 8:52 PM, Yubing (Tom) Dong 董玉冰
> <to...@gmail.com> wrote:
> > Hi Erik,
> >
> > Thanks for the reply! Do you mean parse and modify the documents before
> > sending them to Solr?
> >
> > Cheers,
> > Yubing
> >
> > On Mon, Nov 3, 2014 at 8:48 PM, Erick Erickson <er...@gmail.com>
> > wrote:
> >
> >> Wouldn't it be easiest to compute the span at index time? Then it's
> >> very straight-forward.
> >>
> >> Best,
> >> Erick
> >>
> >> On Mon, Nov 3, 2014 at 8:18 PM, Yubing (Tom) Dong 董玉冰
> >> <to...@gmail.com> wrote:
> >> > Hi,
> >> >
> >> > I'm new to Solr, and I'm having a problem with faceting. I would
> really
> >> > appreciate it if you could help :)
> >> >
> >> > I have a set of documents in JSON format, which I could post to my
> Solr
> >> > core using the post.jar tool. Each document contains two fields,
> namely
> >> > "startDate" and "endDate", both of which are of type "date".
> >> >
> >> > Conceptually, I would like to have a third field "timeSpan" that is
> >> > automatically generated from the return value of function query
> >> > "ms(endDate, startDate)", and do range facet on it, i.e. compute the
> >> > distribution of "timeSpan", among either all of or a filtered subset
> of
> >> the
> >> > documents.
> >> >
> >> > I have tried to find ways of both directly faceting the function
> return
> >> > values and automatically generate the "timeSpan" field during
> indexing,
> >> but
> >> > without luck yet.
> >> >
> >> > Suggestions are greatly appreciated!
> >> >
> >> > Best,
> >> > Yubing
> >>
>

Re: Faceting return value of a function query?

Posted by Erick Erickson <er...@gmail.com>.
Yep. It's almost always easier and faster if you can pre-compute as
much as possible during indexing time. It'll take longer to   index of
course, but the ratio of writing to the index to searching is usually
hugely in favor of doing the work during indexing.

Best,
Erick

On Mon, Nov 3, 2014 at 8:52 PM, Yubing (Tom) Dong 董玉冰
<to...@gmail.com> wrote:
> Hi Erik,
>
> Thanks for the reply! Do you mean parse and modify the documents before
> sending them to Solr?
>
> Cheers,
> Yubing
>
> On Mon, Nov 3, 2014 at 8:48 PM, Erick Erickson <er...@gmail.com>
> wrote:
>
>> Wouldn't it be easiest to compute the span at index time? Then it's
>> very straight-forward.
>>
>> Best,
>> Erick
>>
>> On Mon, Nov 3, 2014 at 8:18 PM, Yubing (Tom) Dong 董玉冰
>> <to...@gmail.com> wrote:
>> > Hi,
>> >
>> > I'm new to Solr, and I'm having a problem with faceting. I would really
>> > appreciate it if you could help :)
>> >
>> > I have a set of documents in JSON format, which I could post to my Solr
>> > core using the post.jar tool. Each document contains two fields, namely
>> > "startDate" and "endDate", both of which are of type "date".
>> >
>> > Conceptually, I would like to have a third field "timeSpan" that is
>> > automatically generated from the return value of function query
>> > "ms(endDate, startDate)", and do range facet on it, i.e. compute the
>> > distribution of "timeSpan", among either all of or a filtered subset of
>> the
>> > documents.
>> >
>> > I have tried to find ways of both directly faceting the function return
>> > values and automatically generate the "timeSpan" field during indexing,
>> but
>> > without luck yet.
>> >
>> > Suggestions are greatly appreciated!
>> >
>> > Best,
>> > Yubing
>>

Re: Faceting return value of a function query?

Posted by "Yubing Dong 董玉冰 (Tom)" <to...@gmail.com>.
Hi Erik,

Thanks for the reply! Do you mean parse and modify the documents before
sending them to Solr?

Cheers,
Yubing

On Mon, Nov 3, 2014 at 8:48 PM, Erick Erickson <er...@gmail.com>
wrote:

> Wouldn't it be easiest to compute the span at index time? Then it's
> very straight-forward.
>
> Best,
> Erick
>
> On Mon, Nov 3, 2014 at 8:18 PM, Yubing (Tom) Dong 董玉冰
> <to...@gmail.com> wrote:
> > Hi,
> >
> > I'm new to Solr, and I'm having a problem with faceting. I would really
> > appreciate it if you could help :)
> >
> > I have a set of documents in JSON format, which I could post to my Solr
> > core using the post.jar tool. Each document contains two fields, namely
> > "startDate" and "endDate", both of which are of type "date".
> >
> > Conceptually, I would like to have a third field "timeSpan" that is
> > automatically generated from the return value of function query
> > "ms(endDate, startDate)", and do range facet on it, i.e. compute the
> > distribution of "timeSpan", among either all of or a filtered subset of
> the
> > documents.
> >
> > I have tried to find ways of both directly faceting the function return
> > values and automatically generate the "timeSpan" field during indexing,
> but
> > without luck yet.
> >
> > Suggestions are greatly appreciated!
> >
> > Best,
> > Yubing
>

Re: Faceting return value of a function query?

Posted by Erick Erickson <er...@gmail.com>.
Wouldn't it be easiest to compute the span at index time? Then it's
very straight-forward.

Best,
Erick

On Mon, Nov 3, 2014 at 8:18 PM, Yubing (Tom) Dong 董玉冰
<to...@gmail.com> wrote:
> Hi,
>
> I'm new to Solr, and I'm having a problem with faceting. I would really
> appreciate it if you could help :)
>
> I have a set of documents in JSON format, which I could post to my Solr
> core using the post.jar tool. Each document contains two fields, namely
> "startDate" and "endDate", both of which are of type "date".
>
> Conceptually, I would like to have a third field "timeSpan" that is
> automatically generated from the return value of function query
> "ms(endDate, startDate)", and do range facet on it, i.e. compute the
> distribution of "timeSpan", among either all of or a filtered subset of the
> documents.
>
> I have tried to find ways of both directly faceting the function return
> values and automatically generate the "timeSpan" field during indexing, but
> without luck yet.
>
> Suggestions are greatly appreciated!
>
> Best,
> Yubing