Kekoa
Kekoa

Reputation: 28240

Solr Query on Unique Integer Field

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?

Upvotes: 3

Views: 5402

Answers (1)

Mauricio Scheffer
Mauricio Scheffer

Reputation: 99730

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

Upvotes: 8

Related Questions