Solr search with array of values on field

荒凉一梦 提交于 2019-12-22 09:09:21

问题


I'm new in Solr search. Can anyone help me for solr my problem. I have array of values and I want to add this in solr query like

$query->setQuery('field:[1,2,5]');

When I'm executing this then I get this error message

org.apache.solr.search.SyntaxError: Cannot parse 'tag_id:[1,2,5]': Encountered \" \"]\" \"] \"\" at line 1, column 13.\r\nWas expecting one of:\r\n    \"TO\" ...\r\n    <RANGE_QUOTED> ...\r\n    <RANGE_GOOP> ...\r\n    

I'm stuck on this. Please help me.


回答1:


try with filter query

https://cwiki.apache.org/confluence/display/solr/Common+Query+Parameters#CommonQueryParameters-Thefq(FilterQuery)Parameter

tag_id=cat:(1 OR 2 OR 5)


来源:https://stackoverflow.com/questions/31422013/solr-search-with-array-of-values-on-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!