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 Felipe Carvalho <fe...@gmail.com> on 2011/11/21 02:35:08 UTC
Filtering search results
Hello,
I'm working on a people finder app over an index built of Person
documents. Among other attributes (name, gender, phone, ...) I have a
hiringType attribute, which possible values are EMPLOYEE and CONSULTANT.
When I run a "name" search over these documents, I need to render two
lists: employees that match the search criteria and consultants that match
the criteria.
I'm running Lucene 3.4, is there a way for Lucene to hand me over those
lists of documents separately on the same query?
Currently I run the query and then loop through the results, separating
employees and consultants in two lists, is there a better way to do this?
A heard a colleague saying Solr supports this through "faceted search"
(I'm not sure this is the right name), is there such thing on Lucene as
well? (unfortunately using Solr is not an option for this app)
Thanks!
Re: Filtering search results
Posted by Felipe Carvalho <fe...@gmail.com>.
I'd really love to use Solr, but unfortunately this is not an option for
this project I'm working on, Would anybody have a pointer to an article or
a few lines of code showing how to use this using Lucene core?
I've done quite some digging on Google, but I could only people suggesting
to use Solr instead.
Thanks for any help anyone may give.
On Mon, Nov 21, 2011 at 12:25 PM, Erick Erickson <er...@gmail.com>wrote:
> http://wiki.apache.org/solr/FieldCollapsing
>
> On Mon, Nov 21, 2011 at 8:17 AM, Felipe Carvalho
> <fe...@gmail.com> wrote:
> > Thanks for the tip, Erick! Any pointer to any article showing how to use
> it?
> >
> > Thanks
> >
> > On Mon, Nov 21http://wiki.apache.org/solr/FieldCollapsing, 2011 at
> 10:49 AM, Erick Erickson <er...@gmail.com>wrote:
> >
> >> You might take a look at grouping, aka field collapsing. Faceting gives
> >> you counts for various values in a field, but not a mixture of
> documents,
> >> whereas grouping will return you the top N members of each group
> >> which sounds like what you're after.
> >>
> >> Best
> >> Erick
> >>
> >> On Mon, Nov 21, 2011 at 5:04 AM, Ian Lea <ia...@gmail.com> wrote:
> >> > Running two queries is fine, as is looping through the results list.
> >> > I don't think it is clear that one in necessarily "better" than the
> >> > other. Faceting generally works by looping through results because
> >> > you typically don't know in advance what values will be present.
> >> >
> >> > --
> >> > Ian,
> >> >
> >> >
> >> > 2011/11/21 liugangc <li...@gmail.com>:
> >> >> hi,faceted search is like group by in SQL, and also need query two
> time
> >> to get two list in your situation. I think there isn't better way to
> solve
> >> your problem.
> >> >>
> >> >> --
> >> >> gang liu
> >> >> email: liugangc@gmail.com
> >> >>
> >> >>
> >> >>
> >> >> At 2011-11-21 09:35:08,"Felipe Carvalho" <fe...@gmail.com>
> >> wrote:
> >> >>>Hello,
> >> >>> I'm working on a people finder app over an index built of Person
> >> >>>documents. Among other attributes (name, gender, phone, ...) I have a
> >> >>>hiringType attribute, which possible values are EMPLOYEE and
> CONSULTANT.
> >> >>> When I run a "name" search over these documents, I need to render
> two
> >> >>>lists: employees that match the search criteria and consultants that
> >> match
> >> >>>the criteria.
> >> >>> I'm running Lucene 3.4, is there a way for Lucene to hand me over
> >> those
> >> >>>lists of documents separately on the same query?
> >> >>> Currently I run the query and then loop through the results,
> >> separating
> >> >>>employees and consultants in two lists, is there a better way to do
> >> this?
> >> >>> A heard a colleague saying Solr supports this through "faceted
> search"
> >> >>>(I'm not sure this is the right name), is there such thing on Lucene
> as
> >> >>>well? (unfortunately using Solr is not an option for this app)
> >> >>>
> >> >>>Thanks!
> >> >>
> >> >
> >> > ---------------------------------------------------------------------
> >> > 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
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
Re: Filtering search results
Posted by Erick Erickson <er...@gmail.com>.
http://wiki.apache.org/solr/FieldCollapsing
On Mon, Nov 21, 2011 at 8:17 AM, Felipe Carvalho
<fe...@gmail.com> wrote:
> Thanks for the tip, Erick! Any pointer to any article showing how to use it?
>
> Thanks
>
> On Mon, Nov 21http://wiki.apache.org/solr/FieldCollapsing, 2011 at 10:49 AM, Erick Erickson <er...@gmail.com>wrote:
>
>> You might take a look at grouping, aka field collapsing. Faceting gives
>> you counts for various values in a field, but not a mixture of documents,
>> whereas grouping will return you the top N members of each group
>> which sounds like what you're after.
>>
>> Best
>> Erick
>>
>> On Mon, Nov 21, 2011 at 5:04 AM, Ian Lea <ia...@gmail.com> wrote:
>> > Running two queries is fine, as is looping through the results list.
>> > I don't think it is clear that one in necessarily "better" than the
>> > other. Faceting generally works by looping through results because
>> > you typically don't know in advance what values will be present.
>> >
>> > --
>> > Ian,
>> >
>> >
>> > 2011/11/21 liugangc <li...@gmail.com>:
>> >> hi,faceted search is like group by in SQL, and also need query two time
>> to get two list in your situation. I think there isn't better way to solve
>> your problem.
>> >>
>> >> --
>> >> gang liu
>> >> email: liugangc@gmail.com
>> >>
>> >>
>> >>
>> >> At 2011-11-21 09:35:08,"Felipe Carvalho" <fe...@gmail.com>
>> wrote:
>> >>>Hello,
>> >>> I'm working on a people finder app over an index built of Person
>> >>>documents. Among other attributes (name, gender, phone, ...) I have a
>> >>>hiringType attribute, which possible values are EMPLOYEE and CONSULTANT.
>> >>> When I run a "name" search over these documents, I need to render two
>> >>>lists: employees that match the search criteria and consultants that
>> match
>> >>>the criteria.
>> >>> I'm running Lucene 3.4, is there a way for Lucene to hand me over
>> those
>> >>>lists of documents separately on the same query?
>> >>> Currently I run the query and then loop through the results,
>> separating
>> >>>employees and consultants in two lists, is there a better way to do
>> this?
>> >>> A heard a colleague saying Solr supports this through "faceted search"
>> >>>(I'm not sure this is the right name), is there such thing on Lucene as
>> >>>well? (unfortunately using Solr is not an option for this app)
>> >>>
>> >>>Thanks!
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > 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
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Filtering search results
Posted by Felipe Carvalho <fe...@gmail.com>.
Thanks for the tip, Erick! Any pointer to any article showing how to use it?
Thanks
On Mon, Nov 21, 2011 at 10:49 AM, Erick Erickson <er...@gmail.com>wrote:
> You might take a look at grouping, aka field collapsing. Faceting gives
> you counts for various values in a field, but not a mixture of documents,
> whereas grouping will return you the top N members of each group
> which sounds like what you're after.
>
> Best
> Erick
>
> On Mon, Nov 21, 2011 at 5:04 AM, Ian Lea <ia...@gmail.com> wrote:
> > Running two queries is fine, as is looping through the results list.
> > I don't think it is clear that one in necessarily "better" than the
> > other. Faceting generally works by looping through results because
> > you typically don't know in advance what values will be present.
> >
> > --
> > Ian,
> >
> >
> > 2011/11/21 liugangc <li...@gmail.com>:
> >> hi,faceted search is like group by in SQL, and also need query two time
> to get two list in your situation. I think there isn't better way to solve
> your problem.
> >>
> >> --
> >> gang liu
> >> email: liugangc@gmail.com
> >>
> >>
> >>
> >> At 2011-11-21 09:35:08,"Felipe Carvalho" <fe...@gmail.com>
> wrote:
> >>>Hello,
> >>> I'm working on a people finder app over an index built of Person
> >>>documents. Among other attributes (name, gender, phone, ...) I have a
> >>>hiringType attribute, which possible values are EMPLOYEE and CONSULTANT.
> >>> When I run a "name" search over these documents, I need to render two
> >>>lists: employees that match the search criteria and consultants that
> match
> >>>the criteria.
> >>> I'm running Lucene 3.4, is there a way for Lucene to hand me over
> those
> >>>lists of documents separately on the same query?
> >>> Currently I run the query and then loop through the results,
> separating
> >>>employees and consultants in two lists, is there a better way to do
> this?
> >>> A heard a colleague saying Solr supports this through "faceted search"
> >>>(I'm not sure this is the right name), is there such thing on Lucene as
> >>>well? (unfortunately using Solr is not an option for this app)
> >>>
> >>>Thanks!
> >>
> >
> > ---------------------------------------------------------------------
> > 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: Filtering search results
Posted by Erick Erickson <er...@gmail.com>.
You might take a look at grouping, aka field collapsing. Faceting gives
you counts for various values in a field, but not a mixture of documents,
whereas grouping will return you the top N members of each group
which sounds like what you're after.
Best
Erick
On Mon, Nov 21, 2011 at 5:04 AM, Ian Lea <ia...@gmail.com> wrote:
> Running two queries is fine, as is looping through the results list.
> I don't think it is clear that one in necessarily "better" than the
> other. Faceting generally works by looping through results because
> you typically don't know in advance what values will be present.
>
> --
> Ian,
>
>
> 2011/11/21 liugangc <li...@gmail.com>:
>> hi,faceted search is like group by in SQL, and also need query two time to get two list in your situation. I think there isn't better way to solve your problem.
>>
>> --
>> gang liu
>> email: liugangc@gmail.com
>>
>>
>>
>> At 2011-11-21 09:35:08,"Felipe Carvalho" <fe...@gmail.com> wrote:
>>>Hello,
>>> I'm working on a people finder app over an index built of Person
>>>documents. Among other attributes (name, gender, phone, ...) I have a
>>>hiringType attribute, which possible values are EMPLOYEE and CONSULTANT.
>>> When I run a "name" search over these documents, I need to render two
>>>lists: employees that match the search criteria and consultants that match
>>>the criteria.
>>> I'm running Lucene 3.4, is there a way for Lucene to hand me over those
>>>lists of documents separately on the same query?
>>> Currently I run the query and then loop through the results, separating
>>>employees and consultants in two lists, is there a better way to do this?
>>> A heard a colleague saying Solr supports this through "faceted search"
>>>(I'm not sure this is the right name), is there such thing on Lucene as
>>>well? (unfortunately using Solr is not an option for this app)
>>>
>>>Thanks!
>>
>
> ---------------------------------------------------------------------
> 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: Filtering search results
Posted by Ian Lea <ia...@gmail.com>.
Running two queries is fine, as is looping through the results list.
I don't think it is clear that one in necessarily "better" than the
other. Faceting generally works by looping through results because
you typically don't know in advance what values will be present.
--
Ian,
2011/11/21 liugangc <li...@gmail.com>:
> hi,faceted search is like group by in SQL, and also need query two time to get two list in your situation. I think there isn't better way to solve your problem.
>
> --
> gang liu
> email: liugangc@gmail.com
>
>
>
> At 2011-11-21 09:35:08,"Felipe Carvalho" <fe...@gmail.com> wrote:
>>Hello,
>> I'm working on a people finder app over an index built of Person
>>documents. Among other attributes (name, gender, phone, ...) I have a
>>hiringType attribute, which possible values are EMPLOYEE and CONSULTANT.
>> When I run a "name" search over these documents, I need to render two
>>lists: employees that match the search criteria and consultants that match
>>the criteria.
>> I'm running Lucene 3.4, is there a way for Lucene to hand me over those
>>lists of documents separately on the same query?
>> Currently I run the query and then loop through the results, separating
>>employees and consultants in two lists, is there a better way to do this?
>> A heard a colleague saying Solr supports this through "faceted search"
>>(I'm not sure this is the right name), is there such thing on Lucene as
>>well? (unfortunately using Solr is not an option for this app)
>>
>>Thanks!
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re:Filtering search results
Posted by liugangc <li...@gmail.com>.
hi,faceted search is like group by in SQL, and also need query two time to get two list in your situation. I think there isn't better way to solve your problem.
--
gang liu
email: liugangc@gmail.com
At 2011-11-21 09:35:08,"Felipe Carvalho" <fe...@gmail.com> wrote:
>Hello,
> I'm working on a people finder app over an index built of Person
>documents. Among other attributes (name, gender, phone, ...) I have a
>hiringType attribute, which possible values are EMPLOYEE and CONSULTANT.
> When I run a "name" search over these documents, I need to render two
>lists: employees that match the search criteria and consultants that match
>the criteria.
> I'm running Lucene 3.4, is there a way for Lucene to hand me over those
>lists of documents separately on the same query?
> Currently I run the query and then loop through the results, separating
>employees and consultants in two lists, is there a better way to do this?
> A heard a colleague saying Solr supports this through "faceted search"
>(I'm not sure this is the right name), is there such thing on Lucene as
>well? (unfortunately using Solr is not an option for this app)
>
>Thanks!