Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 814
Kekoa Avatar asked Nov 18 '25 00:11

Kekoa


1 Answers

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
like image 94
Mauricio Scheffer Avatar answered Nov 19 '25 14:11

Mauricio Scheffer