唯一整数字段上的Solr查询 [英] Solr Query on Unique Integer Field

查看:103
本文介绍了唯一整数字段上的Solr查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < field name =idtype =integer indexed =truestored =truerequired =true/> 

架构也是 uniqueKey

我无法使用查询网址对此字段执行查询:

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

这不会返回任何结果,但是,如果我在不同的字段(如文本字段)上搜索不同的查询,我会得到很多结果,其中包括存储的ID。 Solr对于文本字段非常有用,但是我无法根据唯一ID查询项目。



我错过了什么?是否还有其他需要执行索引的步骤?

解决方案

看起来您正在使用 qf参数错误的方式......它只是用来提升dismax查询中的字段。
使用 id:4525 代替:

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


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?

解决方案

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

这篇关于唯一整数字段上的Solr查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆