You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by James liu <li...@gmail.com> on 2006/07/20 05:34:00 UTC

Can lucene query this result?

for example:

$sql = "select count(*), user_group from groups where uid>0 group by
user_group;


can lucene query this result?

Re: Can lucene query this result?

Posted by Heng Mei <he...@gmail.com>.
I don't think there's an easy "built-in" way for Lucene to do this.

What you can do is implement a HitCollector to process each doc hit
and maintain a count for each user_group.  You'll need to preload a
doc_id -> user_group mapping.  (Take a look at the code for
FieldCacheImpl.getInts() for sample code).

~Heng

On 7/19/06, James liu <li...@gmail.com> wrote:
> You misunderstand.
>
> This sql just tell what i wanna do.
>
> i have five user_group and i wanna group result which lucene do.
>
> 2006/7/20, Otis Gospodnetic <ot...@yahoo.com>:
> >
> > No.  Lucene is not a relational database and doesn't speak SQL.
> >
> > Otis
> >
> > ----- Original Message ----
> > From: James liu <li...@gmail.com>
> > To: java-user@lucene.apache.org
> > Sent: Wednesday, July 19, 2006 11:34:00 PM
> > Subject: Can lucene query this result?
> >
> > for example:
> >
> > $sql = "select count(*), user_group from groups where uid>0 group by
> > user_group;
> >
> >
> > can lucene query this result?
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Can lucene query this result?

Posted by James liu <li...@gmail.com>.
You misunderstand.

This sql just tell what i wanna do.

i have five user_group and i wanna group result which lucene do.

2006/7/20, Otis Gospodnetic <ot...@yahoo.com>:
>
> No.  Lucene is not a relational database and doesn't speak SQL.
>
> Otis
>
> ----- Original Message ----
> From: James liu <li...@gmail.com>
> To: java-user@lucene.apache.org
> Sent: Wednesday, July 19, 2006 11:34:00 PM
> Subject: Can lucene query this result?
>
> for example:
>
> $sql = "select count(*), user_group from groups where uid>0 group by
> user_group;
>
>
> can lucene query this result?
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: Can lucene query this result?

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Well, you could use a range query with the "right side" of the query open/null, but this is not really what Lucene is designed for.

Otis

----- Original Message ----
From: Otis Gospodnetic <ot...@yahoo.com>
To: java-user@lucene.apache.org
Sent: Thursday, July 20, 2006 12:31:29 AM
Subject: Re: Can lucene query this result?

No.  Lucene is not a relational database and doesn't speak SQL.

Otis

----- Original Message ----
From: James liu <li...@gmail.com>
To: java-user@lucene.apache.org
Sent: Wednesday, July 19, 2006 11:34:00 PM
Subject: Can lucene query this result?

for example:

$sql = "select count(*), user_group from groups where uid>0 group by
user_group;


can lucene query this result?




---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Can lucene query this result?

Posted by Otis Gospodnetic <ot...@yahoo.com>.
No.  Lucene is not a relational database and doesn't speak SQL.

Otis

----- Original Message ----
From: James liu <li...@gmail.com>
To: java-user@lucene.apache.org
Sent: Wednesday, July 19, 2006 11:34:00 PM
Subject: Can lucene query this result?

for example:

$sql = "select count(*), user_group from groups where uid>0 group by
user_group;


can lucene query this result?




---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org