Henrique Ordine
Henrique Ordine

Reputation: 3337

hybris FlexibleSearchService can't find a product that actually exists

I'm trying to add a product to my cart, like this:

cartFacade.addToCart("M300044", 2);

And it fails with: Product with code 'M300044' not found!

When I debug the code, I find that this query is executed by FlexibleSearchService.search(query):

SELECT {c:pk} FROM {Product AS c} WHERE {c:code}='M300044' 

If I execute this query on my hybris Admin console, I do get a Product as a result.

Why can't FlexibleSearchService find it though? Is it something to do with setting a catalog version somewhere?

Upvotes: 1

Views: 6289

Answers (6)

Anoop
Anoop

Reputation: 1

initialize Junit tenant so by checking import sample data yes so that data which you have in production will be available for testing.

Upvotes: 0

prashant kumar
prashant kumar

Reputation: 145

I believe this is a SYNCHRONIZATION issue. STAGED Product Version is not aligned with Online. You have two options. HMC > System > Facet Search > indexer wizard. Product Cockpit.

Upvotes: 1

Gaurav Mittal
Gaurav Mittal

Reputation: 11

You need to make sure one more thing that you have set the session user = admin , because if there is a restriction applied on u r product then your test case won't work

Upvotes: 1

Henrique Ordine
Henrique Ordine

Reputation: 3337

In this case it was because I was doing this from a Test class, so hybris couldn´t find the product because there was no data whatsoever in the junit tenant.

So I had to create the data in the setup method of my Test class, which is executed before the actual test method is called.

Upvotes: 3

Karthick
Karthick

Reputation: 28

Check available stock for product in hmc. May this help you

Upvotes: 0

Abed Yaseen
Abed Yaseen

Reputation: 522

you need to make full SOLR indexing for the products from hmc before they can appear in front end store or using hypris APIs hope that help

Upvotes: -1

Related Questions