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 nbuso <nb...@ebi.ac.uk> on 2020/07/29 09:27:53 UTC

Hierarchical facet select a subtree but one child

Hi,

I'm a bit rusty with Lucene facets API and I have a common use case that 
I would like to solve.
Suppose the following facet values tree:

Facet
  - V1
    - V1.1
    - V1.2
    - V1.3
    - V1.4
    - (not topK values)
  - V2
    - V2.1
    - V2.2
    - V2.3
    - V2.4
    - (not topK values)

With (not topK values) I mean values you are not showing in the UI 
because of space/visualization problems. You usually see them with the 
links "More ..."

Use case:
1 - select V1 => all V1.x are selected
2 - de-select V1.1

How can I achieve this? from the search results I know the values 
V1.[1-4] but I don't know the values that are not in topK. How can I 
select all the V1 subtree but V1.1?

Please let me know if you need more info.


Nicola Buso - EBI

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


Re: Hierarchical facet select a subtree but one child

Posted by nbuso <nb...@ebi.ac.uk>.
Hi,

yes my aim was to introduce the functionality on the facet package.
I created a ticket and added a simple patch; the use case seems to apply 
only to hierarchical facets, maybe we can add a validation to avoid to 
use the method in other cases.

I'm happy to make modifications to the patch if you have any comment.

https://issues.apache.org/jira/browse/LUCENE-9979

Nicola Buso

On 2020-08-17 15:14, Michael McCandless wrote:
> I think this is a missing API in DrillDownQuery?
> 
> Nicola, could you open an issue?
> 
> The filtering is as Mike Sokolov described, but I think we should add
> a sugar method, e.g. DrillDownQuery.remove or something, to add a
> negated query clause.
> 
> And until this API is added and you can upgrade to it, you can
> construct your own TermQuery and then add it as a MUST_NOT clause.
> Look at how DrillDownQuery.add converts incoming facet paths to terms
> and use that public DrillDownQuery.term method it exposes to create
> your own negated TermQuery.
> 
> Mike McCandless
> 
> http://blog.mikemccandless.com
> 
> On Sat, Aug 15, 2020 at 11:55 AM Michael Sokolov <ms...@gmail.com>
> wrote:
> 
>> If you are trying to show documents that have facet value V1
>> excluding
>> those with facet value V1.1, then you would need to issue a query
>> like:
>> 
>> +f:V1 -f:V1.1
>> 
>> assuming your facet values are indexed in a field called "f". I
>> don't
>> think this really has anything to do with faceting; it's just a
>> filtering problem.
>> 
>> On Tue, Aug 4, 2020 at 4:47 AM nbuso <nb...@ebi.ac.uk> wrote:
>>> 
>>> Hi,
>>> 
>>> is there someone that can point me in the right API to negate
>> facet
>>> values?
>>> May be this DrillDownQuery#add(dim, query) the API to permit this
>> use
>>> case?
>>> 
>> 
> https://lucene.apache.org/core/8_5_2/facet/org/apache/lucene/facet/DrillDownQuery.html#add-java.lang.String-org.apache.lucene.search.Query-
>>> 
>>> 
>>> Nicola
>>> 
>>> 
>>> On 2020-07-29 10:27, nbuso wrote:
>>>> Hi,
>>>> 
>>>> I'm a bit rusty with Lucene facets API and I have a common use
>> case
>>>> that I would like to solve.
>>>> Suppose the following facet values tree:
>>>> 
>>>> Facet
>>>>  - V1
>>>>    - V1.1
>>>>    - V1.2
>>>>    - V1.3
>>>>    - V1.4
>>>>    - (not topK values)
>>>>  - V2
>>>>    - V2.1
>>>>    - V2.2
>>>>    - V2.3
>>>>    - V2.4
>>>>    - (not topK values)
>>>> 
>>>> With (not topK values) I mean values you are not showing in the
>> UI
>>>> because of space/visualization problems. You usually see them
>> with the
>>>> links "More ..."
>>>> 
>>>> Use case:
>>>> 1 - select V1 => all V1.x are selected
>>>> 2 - de-select V1.1
>>>> 
>>>> How can I achieve this? from the search results I know the
>> values
>>>> V1.[1-4] but I don't know the values that are not in topK. How
>> can I
>>>> select all the V1 subtree but V1.1?
>>>> 
>>>> Please let me know if you need more info.
>>>> 
>>>> 
>>>> Nicola Buso - EBI
>>>> 
>>>> 
>> 
> ---------------------------------------------------------------------
>>>> 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

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


Re: Hierarchical facet select a subtree but one child

Posted by Michael McCandless <lu...@mikemccandless.com>.
I think this is a missing API in DrillDownQuery?

Nicola, could you open an issue?

The filtering is as Mike Sokolov described, but I think we should add a
sugar method, e.g. DrillDownQuery.remove or something, to add a negated
query clause.

And until this API is added and you can upgrade to it, you can construct
your own TermQuery and then add it as a MUST_NOT clause.  Look at how
DrillDownQuery.add converts incoming facet paths to terms and use that
public DrillDownQuery.term method it exposes to create your own negated
TermQuery.

Mike McCandless

http://blog.mikemccandless.com


On Sat, Aug 15, 2020 at 11:55 AM Michael Sokolov <ms...@gmail.com> wrote:

> If you are trying to show documents that have facet value V1 excluding
> those with facet value V1.1, then you would need to issue a query
> like:
>
>     +f:V1 -f:V1.1
>
> assuming your facet values are indexed in a field called "f". I don't
> think this really has anything to do with faceting; it's just a
> filtering problem.
>
> On Tue, Aug 4, 2020 at 4:47 AM nbuso <nb...@ebi.ac.uk> wrote:
> >
> > Hi,
> >
> > is there someone that can point me in the right API to negate facet
> > values?
> > May be this DrillDownQuery#add(dim, query) the API to permit this use
> > case?
> >
> https://lucene.apache.org/core/8_5_2/facet/org/apache/lucene/facet/DrillDownQuery.html#add-java.lang.String-org.apache.lucene.search.Query-
> >
> >
> > Nicola
> >
> >
> > On 2020-07-29 10:27, nbuso wrote:
> > > Hi,
> > >
> > > I'm a bit rusty with Lucene facets API and I have a common use case
> > > that I would like to solve.
> > > Suppose the following facet values tree:
> > >
> > > Facet
> > >  - V1
> > >    - V1.1
> > >    - V1.2
> > >    - V1.3
> > >    - V1.4
> > >    - (not topK values)
> > >  - V2
> > >    - V2.1
> > >    - V2.2
> > >    - V2.3
> > >    - V2.4
> > >    - (not topK values)
> > >
> > > With (not topK values) I mean values you are not showing in the UI
> > > because of space/visualization problems. You usually see them with the
> > > links "More ..."
> > >
> > > Use case:
> > > 1 - select V1 => all V1.x are selected
> > > 2 - de-select V1.1
> > >
> > > How can I achieve this? from the search results I know the values
> > > V1.[1-4] but I don't know the values that are not in topK. How can I
> > > select all the V1 subtree but V1.1?
> > >
> > > Please let me know if you need more info.
> > >
> > >
> > > Nicola Buso - EBI
> > >
> > > ---------------------------------------------------------------------
> > > 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: Hierarchical facet select a subtree but one child

Posted by Michael Sokolov <ms...@gmail.com>.
If you are trying to show documents that have facet value V1 excluding
those with facet value V1.1, then you would need to issue a query
like:

    +f:V1 -f:V1.1

assuming your facet values are indexed in a field called "f". I don't
think this really has anything to do with faceting; it's just a
filtering problem.

On Tue, Aug 4, 2020 at 4:47 AM nbuso <nb...@ebi.ac.uk> wrote:
>
> Hi,
>
> is there someone that can point me in the right API to negate facet
> values?
> May be this DrillDownQuery#add(dim, query) the API to permit this use
> case?
> https://lucene.apache.org/core/8_5_2/facet/org/apache/lucene/facet/DrillDownQuery.html#add-java.lang.String-org.apache.lucene.search.Query-
>
>
> Nicola
>
>
> On 2020-07-29 10:27, nbuso wrote:
> > Hi,
> >
> > I'm a bit rusty with Lucene facets API and I have a common use case
> > that I would like to solve.
> > Suppose the following facet values tree:
> >
> > Facet
> >  - V1
> >    - V1.1
> >    - V1.2
> >    - V1.3
> >    - V1.4
> >    - (not topK values)
> >  - V2
> >    - V2.1
> >    - V2.2
> >    - V2.3
> >    - V2.4
> >    - (not topK values)
> >
> > With (not topK values) I mean values you are not showing in the UI
> > because of space/visualization problems. You usually see them with the
> > links "More ..."
> >
> > Use case:
> > 1 - select V1 => all V1.x are selected
> > 2 - de-select V1.1
> >
> > How can I achieve this? from the search results I know the values
> > V1.[1-4] but I don't know the values that are not in topK. How can I
> > select all the V1 subtree but V1.1?
> >
> > Please let me know if you need more info.
> >
> >
> > Nicola Buso - EBI
> >
> > ---------------------------------------------------------------------
> > 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: Hierarchical facet select a subtree but one child

Posted by nbuso <nb...@ebi.ac.uk>.
Hi,

is there someone that can point me in the right API to negate facet 
values?
May be this DrillDownQuery#add(dim, query) the API to permit this use 
case?
https://lucene.apache.org/core/8_5_2/facet/org/apache/lucene/facet/DrillDownQuery.html#add-java.lang.String-org.apache.lucene.search.Query-


Nicola


On 2020-07-29 10:27, nbuso wrote:
> Hi,
> 
> I'm a bit rusty with Lucene facets API and I have a common use case
> that I would like to solve.
> Suppose the following facet values tree:
> 
> Facet
>  - V1
>    - V1.1
>    - V1.2
>    - V1.3
>    - V1.4
>    - (not topK values)
>  - V2
>    - V2.1
>    - V2.2
>    - V2.3
>    - V2.4
>    - (not topK values)
> 
> With (not topK values) I mean values you are not showing in the UI
> because of space/visualization problems. You usually see them with the
> links "More ..."
> 
> Use case:
> 1 - select V1 => all V1.x are selected
> 2 - de-select V1.1
> 
> How can I achieve this? from the search results I know the values
> V1.[1-4] but I don't know the values that are not in topK. How can I
> select all the V1 subtree but V1.1?
> 
> Please let me know if you need more info.
> 
> 
> Nicola Buso - EBI
> 
> ---------------------------------------------------------------------
> 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