Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

CategoryHandler.GetCategorizedItems vs. GetQueryResult

Vote:
 

Hi,

I have some code that I would think works in a similar way - but turns out to give me different outpu. I am now quite confused and would relly like some help here!

Code A:
CategoryCollection categories = new CategoryCollection();
categories.Add(CategoryHandler.GetCategory(categoryId));
this.TheRepeater.DataSource =
CategoryHandler.GetCategorizedItems(typeof(Club), categories, page, pagesPerPage, out totalItems);

Returns wanted result.

Code B:
ClubQuery clubQuery = new ClubQuery();
clubQuery.Categories = new CategoryCollectionCriterion();
clubQuery.Categories.Containing = new CategoryCriterion();
clubQuery.Categories.Containing.ID = new IntegerCriterion();
clubQuery.Categories.Containing.ID.Value = categoryId;
this.TheRepeater.DataSource = ClubHandler.GetQueryResult(clubQuery, page, pagesPerPage, out totalItems);

Does not return anything.

#23328
Sep 03, 2008 14:00
Vote:
 

Hi Jonas,

It should result in the same data being returned, except for the matter of sorting.

Have you verified what the value of totalItems is after running GetQueryResult? 

#23421
Sep 05, 2008 10:06
Vote:
 
Hmm... the ClubQuery method seems to work rather randomized for me. Exactly the same query on the same page produces different results. If I search using one criteria, A, then searches using another criteria, and finally search using A again, A produces different result. Is this a cache issue perhaps?
#23507
Sep 08, 2008 13:33
Vote:
 

There is a cache issue in the query system that has been resolved and will be fixed with an update in a near future. This sounds like the problem in question.

You could work around this problem by clearing the query cache before executing the query by calling QueryHandler.RemoveQueryResultCache(query); 

#23545
Sep 09, 2008 10:43
Vote:
 

QueryHandler.RemoveQueryResultCache(query);  

Where is this method located?

As in wich dll? We have searched for this quite extensively, but not found it.

 

We ended up using:

StarSuite.Core.Cache.CacheHandler.RemoveCachedObject(new string[] { "StarCommunityQueries", "Query" });

wich is quite inefficient and dirty, but atleast it works.

#25461
Oct 27, 2008 14:21
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.