gpt4 book ai didi

mysql - SOLR - MYSQL - 查询结果

转载 作者:行者123 更新时间:2023-11-30 23:31:40 24 4
gpt4 key购买 nike

我正在使用 SOLR 和 MySQL。

这是我的data-config.xml

<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/meishidb"
user="root"
password="root"/>
<document>
<entity name="id"
query="SELECT
p.id,
p.occ_name
FROM
BCARDS_OCCUPATION AS p">
<field column="id" name='id'/>
<field column="occ_name" name='occ_name'/>
</entity>
</document>
</dataConfig>

这些是添加到 schema.xml 的行

<field name="id" type="int" indexed="true" stored="true" required="true"/>
<field name="occ_name" type="text" indexed="true" stored="true" required="true"/>

查询运行良好,SOLR 将“n”个文档添加到索引中。问题出在查询索引上;只有当我输入 '*:*' 时,SOLR 才会给我结果,并且只提供关于文档 ID(而不是 occ_name)的结果!

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1</int>
<lst name="params">
<str name="indent">on</str>
<str name="start">0</str>
<str name="q">*:*</str>
<str name="version">2.2</str>
<str name="rows">10</str>
</lst>
</lst>
<result name="response" numFound="5" start="0">
<doc>
<str name="id">1</str>
</doc>
<doc>
<str name="id">2</str>
</doc>
<doc>
<str name="id">3</str>
</doc>
<doc>
<str name="id">4</str>
</doc>
<doc>
<str name="id">5</str>
</doc>
</result>
</response>

如果我搜索:

id:1 给我 id=1 的文档

occ_name:1 给我 'undefined field occ_name'

为什么?

最佳答案

我不知道您是否在您的模式中创建了 fieldType 文本,但在默认模式中没有这样的 fieldType。

尝试在您的 occ_name 字段定义中使用 type="text_en"

顺便说一句(我总是建议同样的事情),使用史上最强大的 Lucene 工具检查索引中的内容,称为 Luke .

关于mysql - SOLR - MYSQL - 查询结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10284288/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com