Solr range query for specefic id like /solr/select?q=x:[1,2,5,11,64589]

本小妞迷上赌 提交于 2020-01-02 04:28:10

问题


I have some specific id like 1,2,5,11,64589 in solr (int type)

I want to qet query like ttp://localhost:8983/solr/select?q=x:[1,2,5,11,64589] but does not work (get error). how can do it ???

Note: i can implement with "OR" but i want simple way (and other problem limit in max url char length)


回答1:


These are your options:

  • ?q=x:(1 OR 2 OR 5 OR ...)
  • ?q=x:1 OR x:2 OR x:5 OR ...
  • ?q=x:(1 2 5 ...) with defaultOperator="OR" (haven't tried this one but it should work)
  • Write your own RequestHandler
  • Write your own QueryParser



回答2:


In Solr 4.10 and Heliosearch 0.07, you can use the more efficient terms query:

q={!terms f=id}1,2,5,11,64589


来源:https://stackoverflow.com/questions/2533815/solr-range-query-for-specefic-id-like-solr-selectq-x1-2-5-11-64589

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