lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rodrigo Vega (JIRA)" <>
Subject [jira] [Commented] (LUCENE-4461) Multiple FacetRequest with the same path creates inconsistent results
Date Tue, 09 Oct 2012 11:44:02 GMT


Rodrigo Vega commented on LUCENE-4461:

In my case the final user can specify his/her default query to show once he/she is logged
into the system. This issue came up when somebody define the same facet request using one
as filter and the other only as a pure count request.

I did not find a clean way to fix it looking through the code, but i'm trying the current
"ugly" solution where "counter" is the request index.

public class CustomCountFacetRequest extends CountFacetRequest {

	private int hashCode;

	public CustomCountFacetRequest(CategoryPath path, int num) {
		this(path, num, 0);

	public CustomCountFacetRequest(CategoryPath path, int num, int counter) {
		super(path, num);
		hashCode = super.hashCode() * counter;

	public int hashCode() {
		return hashCode;

	public boolean equals(Object o) {
		if (o instanceof CustomCountFacetRequest) {
			CustomCountFacetRequest that = (CustomCountFacetRequest) o;
			return that.hashCode == this.hashCode && super.equals(o);
		return false;

I didn't find collateral effects on this solution yet, however i'm worried with your comments
about breaking other parts of the code.

I'm not sure if throwing an exception is the best solution, but at least the response will
be consistent.
> Multiple FacetRequest with the same path creates inconsistent results
> ---------------------------------------------------------------------
>                 Key: LUCENE-4461
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/facet
>    Affects Versions: 3.6
>            Reporter: Rodrigo Vega
>              Labels: facet, faceted-search
>         Attachments:
> Multiple FacetRequest are getting merged into one creating wrong results in this case:
> FacetSearchParams facetSearchParams = new FacetSearchParams();
> 		facetSearchParams.addFacetRequest(new CountFacetRequest(new CategoryPath("author"),
> 		facetSearchParams.addFacetRequest(new CountFacetRequest(new CategoryPath("author"),
> Problem can be fixed by defining hashcode and equals in certain way that Lucene recognize
we are talking about different requests.
> Attached test case.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message