我有一个基本的 SOLR 实例
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="my-solr" version="1.5">
<types>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" indexed="true" />
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" indexed="true"/>
</types>
<fields>
<field name="id" type="string" indexed="true" stored="true" required="true" />
<field name="title" type="text_general" indexed="true" stored="true" multiValued="true"/>
</fields>
<uniqueKey>id</uniqueKey>
</schema>
如果我从 SOLR 管理页面发出一个空查询,我会得到一些结果:
<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><arr name="title"><str>Test</str></arr></doc>
<doc><str name="id">2</str><arr name="title"><str>Other Test</str></arr></doc>
</result>
</response>
但是,如果我发出查询title:"test"
(如果我的语法错误,请纠正我),我什么也得不到。
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
<lst name="params">
<str name="indent">on</str>
<str name="start">0</str>
<str name="q">title:"test"</str>
<str name="version">2.2</str>
<str name="rows">10</str>
</lst>
</lst>
<result name="response" numFound="0" start="0"/>
</response>
帮助!