Solr Query on Unique Integer Field

大城市里の小女人 提交于 2020-01-04 05:13:16

问题


I have a field defined in schema.xml as:

<field name="id" type="integer" indexed="true" stored="true" required="true" />

It is also the uniqueKey for the schema.

I cannot perform a query on this field with the query url:

/select?q=4525&qf=id&fl=id,name%2Cscore

This returns no results, however, if I search on a different field(such as a text field), with a different query, I get many results, which include the stored id. Solr is working great for text fields, but I cannot query for items based on the unique id.

What am I missing? Are there other steps that need to be performed for indexing?


回答1:


Looks like you're using the qf parameter the wrong way... it's only meant to be used to boost fields in dismax queries. Use id:4525 instead, as in:

/select?q=id:4525&fl=id,name,score


来源:https://stackoverflow.com/questions/1075761/solr-query-on-unique-integer-field

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