Hybris控制台:
ERROR [hybrisHTTP19] [FlexibleSearch] Flexiblesearch error: missing values for [emailId, productCode], got {13=8796135981138, issent=false, productcode =0100, emailid ='hybrisa@gmail.com'}
ERROR [hybrisHTTP19] [FlexibleSearch] query was 'SELECT {p:pk} FROM {NotifyStock AS p} WHERE {p:status}=?isSent AND {p:productId}=?productCode AND {p:emailId}=?emailId '
ERROR [hybrisHTTP19] [FlexibleSearch] translated query was: SELECT item_t0.PK FROM notifystock item_t0 WHERE ( item_t0.p_status =? AND item_t0.p_productid =? AND item_t0.p_emailid =?) AND (item_t0.TypePkString=? )
Aug 31, 2015 6:51:35 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [DispatcherServlet] in context with path [/store] threw exception [Request processing failed; nested exception is de.hybris.platform.servicelayer.search.exceptions.FlexibleSearchException: missing values for [emailId, productCode], got {13=8796135981138, issent=false, productcode =0100, emailid ='hybrisa@gmail.com'}] with root cause
de.hybris.platform.jalo.flexiblesearch.FlexibleSearchException: missing values for [emailId, productCode], got {13=8796135981138, issent=false, productcode =0100, emailid ='hybrisa@gmail.com'}[HY-0]
at de.hybris.platform.persistence.flexiblesearch.TranslatedQuery.removeUnusedValues(TranslatedQuery.java:274)
at de.hybris.platform.jalo.flexiblesearch.FlexibleSearch.search(FlexibleSearch.java:1423)
at de.hybris.platform.jalo.flexiblesearch.FlexibleSearch.search(FlexibleSearch.java:1627)
at de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService$2.execute(DefaultFlexibleSearchService.java:374)
at de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService$2.execute(DefaultFlexibleSearchService.java:1)
at de.hybris.platform.servicelayer.session.impl.DefaultSessionService.executeInLocalView(DefaultSessionService.java:88)
at de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService.getJaloResult(DefaultFlexibleSearchService.java:363)
at de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService.search(DefaultFlexibleSearchService.java:164)
at de.hybris.merchandise.core.notifystock.NotifyStockServices.isAlreadyExists(NotifyStockServices.java:118)
at de.hybris.merchandise.facades.NotifyStock.impl.NotifyStockFacadeImpl.isAlreadyExists(NotifyStockFacadeImpl.java:51)
at de.hybris.merchandise.storefront.controllers.misc.AddToCartController.verifyEmail(AddToCartController.java:132)
HAC中的工作查询:
select {p:PK} From {NotifyStock AS p} WHERE {p:status}=0 AND {p:productId}=0100 AND {p:emailId}='ertsergt@gmail.com'
Flexiblesearch查询(不工作):
final StringBuilder builder = new StringBuilder();
builder.append("SELECT {p:").append(ItemModel.PK).append("} ");
builder.append("FROM {").append(NotifyStockModel._TYPECODE).append(" AS p} ");
builder.append("WHERE ").append("{p:").append(NotifyStockModel.STATUS).append("}").append("=?isSent ");
builder.append("AND ").append("{p:").append(NotifyStockModel.PRODUCTID).append("}").append("=?productCode ");
builder.append("AND ").append("{p:").append(NotifyStockModel.EMAILID).append("}").append("=?emailId ");
final String email = "\'" + notifyStockModel.getEmailId() + "\'";
final FlexibleSearchQuery query = new FlexibleSearchQuery(builder.toString());
query.setNeedTotal(true);
query.addQueryParameter("isSent", Boolean.FALSE);
query.addQueryParameter("productCode ", notifyStockModel.getProductId());
query.addQueryParameter("emailId ", email);
当我在HAC中触发上述查询时,查询工作正常但是当我使用灵活搜索触发相同的查询时,我得到一些灵活的例外。任何人都可以告诉我在我灵活的搜索查询中有什么错误?任何帮助都会不胜感激吗?
答案 0 :(得分:0)
我认为您在FlexibleSearchQuery中为productCode
和emailId
添加查询参数时会给予额外的空间。这就是为什么你会错过[emailId,productCode]错误的原因。
替换此
query.addQueryParameter("productCode ", notifyStockModel.getProductId()); // extra space after productCode
query.addQueryParameter("emailId ", email); // extra space after emailId
带
query.addQueryParameter("productCode", notifyStockModel.getProductId());
query.addQueryParameter("emailId", email);
希望这能解决您的问题。