Facet Navigation, Result Set, version 7.9.3

76 views
Skip to first unread message

gridi.serbo

unread,
Oct 21, 2014, 8:07:34 AM10/21/14
to hippo-c...@googlegroups.com
Hello guys,

I am experiencing some strange behavior while applying hstQueries to a HippoFacetNavigationBean.
The first time i get the correct result, but for all subsequent queries, I get the same resultSet as the one produced by the first query.
Kind of like there is some caching. 

For applying the query to the facetNavigationBean I am using: ContentBeanUtils.getFacetNavigationBean(HstQuery query, String relPath)
and afterwards getResultSet() 

Please let me know if this is a known issue for you, or if I am doing something wrong?

Thanks a lot,
Gridi Serbo

Ard Schrijvers

unread,
Oct 21, 2014, 12:03:55 PM10/21/14
to hippo-c...@googlegroups.com
Hey Gridi,

On Tue, Oct 21, 2014 at 2:07 PM, gridi.serbo <gridi...@gmail.com> wrote:
> Hello guys,
>
> I am experiencing some strange behavior while applying hstQueries to a
> HippoFacetNavigationBean.
> The first time i get the correct result, but for all subsequent queries, I
> get the same resultSet as the one produced by the first query.

that would be a bug

> Kind of like there is some caching.
>
> For applying the query to the facetNavigationBean I am using:
> ContentBeanUtils.getFacetNavigationBean(HstQuery query, String relPath)

for the relPath you have to point to a node that is of type
hippo:facetednavigation, is that the case?

> and afterwards getResultSet()
>
> Please let me know if this is a known issue for you, or if I am doing
> something wrong?

Can you perhaps show a bit of code snippet? Then if it looks right, I
can try to reproduce it and investigate it...or hopefully directly see
what you are doing wrong :)

Regards Ard



>
> Thanks a lot,
> Gridi Serbo
>
> --
> Hippo Community Group: The place for all discussions and announcements about
> Hippo CMS (and HST, repository etc. etc.)
>
> To post to this group, send email to hippo-c...@googlegroups.com
> RSS:
> https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
> ---
> You received this message because you are subscribed to the Google Groups
> "Hippo Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to hippo-communi...@googlegroups.com.
> Visit this group at http://groups.google.com/group/hippo-community.
> For more options, visit https://groups.google.com/d/optout.



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

Gridi Serbo

unread,
Oct 22, 2014, 4:32:06 AM10/22/14
to hippo-c...@googlegroups.com
Hi Ard,

and thanks a lot for your reply.

This is the complete peace of code. 

HippoFacetNavigationBean facetedNavBean = getFacetNavigationBean(request); //returns null if not instance of HippoFacetNavigationBean
if (facetedNavBean != null) {
HstQuery hstQuery = getHstQuery(request); //construct hstQuery based on dynamic parameters provided by end user
if (hstQuery != null) {
String relPath = PathUtils.absoluteToRelativePath(facetedNavBean.getPath(), request); //it is always a hippo:facetednavigation node path
facetedNavBean = ContentBeanUtils.getFacetNavigationBean(hstQuery, relPath);
}
HippoResultSetBean resultSet = facetedNavBean.getResultSet();
....
        ....
        // ok   // returned facetedNavBean has correct child nodes with correct counts
// KO //  resultSet is always the one provided by the first hstQuery
....
....
}

Thanks again,
Gridi Serbo

Ard Schrijvers

unread,
Oct 22, 2014, 10:22:26 AM10/22/14
to hippo-c...@googlegroups.com
On Wed, Oct 22, 2014 at 10:32 AM, Gridi Serbo <gridi...@gmail.com> wrote:
> Hi Ard,
>
> and thanks a lot for your reply.
>
> This is the complete peace of code.
>
> HippoFacetNavigationBean facetedNavBean = getFacetNavigationBean(request);
> //returns null if not instance of HippoFacetNavigationBean
> if (facetedNavBean != null) {
> HstQuery hstQuery = getHstQuery(request); //construct hstQuery based on
> dynamic parameters provided by end user
> if (hstQuery != null) {
> String relPath = PathUtils.absoluteToRelativePath(facetedNavBean.getPath(),
> request); //it is always a hippo:facetednavigation node path
> facetedNavBean = ContentBeanUtils.getFacetNavigationBean(hstQuery, relPath);
> }
> HippoResultSetBean resultSet = facetedNavBean.getResultSet();
> ....
> ....
> // ok // returned facetedNavBean has correct child nodes with
> correct counts
> // KO // resultSet is always the one provided by the first hstQuery

Although this last part is not completely clear to me, I suspect your
HippoFacetNavigationBean facetedNavBean =
getFacetNavigationBean(request); is also used for 'sub navigation
paths', and that one doesn't take the hst query into account...then
you already have a faceted navigation descendant bean which cannot
take a query any more. It can only handle a query exactly at a node of
type hippo:facetednavigation

To validate this, can you tell me which is the value for

String relPath = PathUtils.absoluteToRelativePath(facetedNavBean.getPath(),

for the resultsets that are correct and the ones that are not correct?

Most likely you need to replace your code with this

HippoFacetNavigationBean facetedNavBean;
HstQuery hstQuery = getHstQuery(request); //construct hstQuery based
on dynamic parameters provided by end user
if (hstQuery != null) {
facetedNavBean = ContentBeanUtils.getFacetNavigationBean(hstQuery);
} else {
facetedNavBean = getFacetNavigationBean(request); //returns null
if not instance of HippoFacetNavigationBean
}
HippoResultSetBean resultSet = facetedNavBean.getResultSet();

I understand it is a bit confusing. Pls let me know if this helps.
Otherwise pls explain your // ok //KO a bit better (which request
works, which doesn't etc etc)

Regards Ard

Gridi Serbo

unread,
Oct 24, 2014, 4:39:37 AM10/24/14
to hippo-c...@googlegroups.com
Hi Ard, 
and thanks again. 

Unfortunately it is not working out so I will try to explain it a little better.

1) HippoFacetNavigationBean facetedNavBean = getFacetNavigationBean(request);
2) if (facetedNavBean != null) {
3) HstQuery hstQuery = getHstQuery(request); 
4) if (hstQuery != null) {
5) String relPath = PathUtils.absoluteToRelativePath(facetedNavBean.getPath(), request);
6) facetedNavBean = ContentBeanUtils.getFacetNavigationBean(hstQuery, relPath);
7) }
8) HippoResultSetBean resultSet = facetedNavBean.getResultSet();

   }

line 1), returns always the bean representing the "hippofacnav:facetnavigation" node configured in the console or null.

line 5), relPath, returned in this line is always the same, the relative path of the node above

Now, arrived at line 8), I have got 2 objects of interest: A) facetedNavBean and B) resultSet.

A) facetNavBean has some correct child nodes: ("hippofacnav:facetsavailablenavigation", "hippofacnav:facetsubnavigation") with correct hippo:count values
B) resultSet which has been obtained also from the same object, (facetedNavBean.getResultSet()) it is not correct. 

The strangest thing is that for the first query being executed, resultSet is correct. 
For all other queries, it is not, it is always the resultSet returned by the first query. Kind of like there is some cache it. Dont know.

Hope I have been a little more clear.

Thanks again,
Gridi Serbo

Ard Schrijvers

unread,
Oct 27, 2014, 4:53:59 AM10/27/14
to hippo-c...@googlegroups.com
Hey Gridi,

On Fri, Oct 24, 2014 at 10:39 AM, Gridi Serbo <gridi...@gmail.com> wrote:
> Hi Ard,
Might be a bug. I will try to reproduce it with your info.

>
> Hope I have been a little more clear.

Yes it is more clear to me. I will try to reproduce your issue. If it
is like you describe it is a bug most definitely. There is indeed some
caching going on, but the cache-key is kind of related to the toString
version of the HstQuery IIRC and this toString is unique per hst
query (that is different). Can you in the mean time try to take a look
at whether the query.toString() returns different values for you when
using different consecutive queries?

Regards Ard, thanks for the detailed feedback

Gridi Serbo

unread,
Oct 27, 2014, 6:14:13 AM10/27/14
to hippo-c...@googlegroups.com
Hi Ard,
and thanks again.

Yes, hstQuery.toString() returns different values for different consecutive queries.

Regards,
Gridi Serbo


Ard Schrijvers

unread,
Oct 27, 2014, 6:17:35 AM10/27/14
to hippo-c...@googlegroups.com
On Mon, Oct 27, 2014 at 11:14 AM, Gridi Serbo <gridi...@gmail.com> wrote:
> Hi Ard,
> and thanks again.
>
> Yes, hstQuery.toString() returns different values for different consecutive
> queries.

Thank you. I'll look into it. Will let you know my findings

Regards Ard

Ard Schrijvers

unread,
Oct 27, 2014, 7:57:54 AM10/27/14
to hippo-c...@googlegroups.com
Hey Gridi,

I cannot reproduce the problem with the Gogreen or Testsuite. I can
only explain your issue if HippoFacetNavigationBean facetedNavBean =
getFacetNavigationBean(request); would already fetch a descendant bean
of the hippo faceted navigation node: Namely then, the root fac nav
node is populated and has a query tight to it.

Would you be able to create a minimal archetype setup exposing the
issue? Or if possible give me something of your code that reproduces
the issue.

Did you try replacing your code with the code below? Although it looks
the same, it behaves quite differently.

If the above are no options, is it possible for you to step debug
through the code? If so, I can ask you whether some points in code are
hit and you can validate that.

Regards Ard

HippoFacetNavigationBean facetedNavBean;
HstQuery hstQuery = getHstQuery(request); //construct hstQuery based
on dynamic parameters provided by end user
if (hstQuery != null) {
facetedNavBean = ContentBeanUtils.getFacetNavigationBean(hstQuery);
} else {
facetedNavBean = getFacetNavigationBean(request); //returns null
if not instance of HippoFacetNavigationBean
}
HippoResultSetBean resultSet = facetedNavBean.getResultSet();

On Mon, Oct 27, 2014 at 11:17 AM, Ard Schrijvers

Gridi Serbo

unread,
Oct 27, 2014, 11:31:36 AM10/27/14
to hippo-c...@googlegroups.com
Hi Ard,

I will try to reproduce the issue in hippogogreen-3.09.02 this evening and will let you know.
If I wont be able, hopefully it will help me understand what am I doing wrong.

Thanks a lot for your patience and time.
Gridi Serbo

Ard Schrijvers

unread,
Oct 28, 2014, 6:05:47 AM10/28/14
to hippo-c...@googlegroups.com
On Mon, Oct 27, 2014 at 4:31 PM, Gridi Serbo <gridi...@gmail.com> wrote:
> Hi Ard,
>
> I will try to reproduce the issue in hippogogreen-3.09.02 this evening and
> will let you know.
> If I wont be able, hopefully it will help me understand what am I doing
> wrong.
>
> Thanks a lot for your patience and time.

You're welcome, I just want to make sure that it is not a product bug.
If you have feedback let me know. After today I will be having 3,5
weeks holiday, so it might take a bit longer, my next reply :)

Regards Ard

Gridi Serbo

unread,
Oct 29, 2014, 4:08:15 AM10/29/14
to hippo-c...@googlegroups.com
Hi Ard,

And thank you very much for your time. 

I have created a class for testing the problem and the same lines of code (changing some constants for document types, document fields and facet paths), that reproduce the bug in my project, do NOT do the same in hippogogreen-3.09.04 and do NOT reproduce it in none of the hippo 7.8.x project instances I have. So for the moment i am completely speechless. 

I will investigate it further (on a newly generated 7.9 project) and let you know.

Thanks again and have a nice holiday.

Cheers,
Gridi Serbo
  

Gridi Serbo

unread,
Nov 11, 2014, 5:06:02 AM11/11/14
to hippo-c...@googlegroups.com
Hello Ard,

Finally I got some time to dig into it and was able to reproduce the bug in hippo-go-green-3.09.04 and also in a clean hippo 7.9 project.
It seems connected to the presence of hippofacnav:sortby and hippofacnav:sortorder properties on the facet node. (hippofacnav:facetnavigation)
If these properties are not there everything is fine, if they are added for all subsequent queries you get the same resultSet as the one produced by the first query executed.

In hippo-go-green-3.07.12 (hippo version 7.8.8) there is no unexpected behaviour even if the above properties are added to the facet node.

Here is how you can reproduce the bug in hippo-go-green-3.09.04.

1) Add the FacetTest class (found in the attachment) in the package: com.onehippo.gogreen.components
2) Add the following line at the end of doBeforeRender method of class: com.onehippo.gogreen.components.products.ProductDetail 
new FacetTest().doFacetTest(request, response);
3) Add properties hippofacnav:sortby and hippofacnav:sortorder to the product facet node: http://localhost:8080/cms/console/?path=/content/documents/hippogogreen/products/facetedproducts 
4) Go to the following links and check the produced logging .


In hippo-go-green-3.07.12 if you substitute line 49 of FacetTest class with the following, 

facetedNavBean = BeanUtils.getFacetNavigationBean(request, hstQuery, FACET_BEAN_PATH, getObjectConverter());

the bug can not be reproduced even if the above properties are added to the products facet.

Can you please take a look at it again? 
Thanks a lot.

Gridi Serbo
FacetTest.java

Ard Schrijvers

unread,
Nov 25, 2014, 10:44:48 AM11/25/14
to hippo-c...@googlegroups.com
Hey Gridi,

Apologies for my late response. I've been on holiday.

Thank you so much for your detailed reproduction, I'll try to
reproduce the issue and fix it asap. I'll create a jira issue after I
can reproduce it. Thanks again

Regards Ard

Ard Schrijvers

unread,
Nov 26, 2014, 5:34:06 AM11/26/14
to hippo-c...@googlegroups.com
Hey Gridi,

I've been able to reproduce the issue and found the cause. You can
follow progress at [1] and [2]. Many thanks again for the detailed
reproduction path as it turned out to be quite complex to trace the
origin

Regards Ard

[1] https://issues.onehippo.com/browse/REPO-1142
[2] https://issues.onehippo.com/browse/REPO-1143

On Tue, Nov 25, 2014 at 4:44 PM, Ard Schrijvers

Gridi Serbo

unread,
Nov 27, 2014, 10:31:53 AM11/27/14
to hippo-c...@googlegroups.com
Hi Ard,

Just noticed your mails. Thank you very much for everything.

In the meanwhile, may I ask for another small change? 
It is related to the parameters "hst:repobased", "hst:foldersonly" and "hst:depth" of sitemenu items.

For having them work properly in the channel manager some small changes should be done to the class: "org.hippoecm.hst.plugins.frontend.editor.dao.SitemenuItemDAO"

The lines that need to change are: 

94 and 98: Boolean.getBoolean(..) should become Boolean.valueOf(..) and in line 
102: Long.getLong(..) should become Long.valueOf(..)

Can you please do also these changes with the next release?

Thanks in advance,
Gridi Serbo

Ard Schrijvers

unread,
Nov 28, 2014, 4:14:35 AM11/28/14
to hippo-c...@googlegroups.com
Hey Gridi,

in general please start a new thread on a new topic. However since it
is such a trivial (and common due to insane java api
Boolean.getBoolean) bug, I've directly picked it up and fixed it in
[1] and [2]. Thanks for spotting!

Regards Ard

[1] https://issues.onehippo.com/browse/HSTCONFIGEDIT-155
[2] https://issues.onehippo.com/browse/HSTCONFIGEDIT-156
Reply all
Reply to author
Forward
0 new messages