我正在努力让 solr 与我的组织合作。它在 tomcat 6 上设置为多核 solr 3.6。
到目前为止,我已经修改了示例 schema.xml 以接受我们记录的特定字段。记录没有问题,当我对所有记录 ( ?q=*:*
) 运行查询时,它会返回所有内容。但是当我查询绝对在记录中的特定术语时(例如?q=green
or ?q=product_description:green
),没有结果出现。虽然如果我插入一些默认示例文档,如 ipod_video.xml 或 ipod_other.xml,但如果搜索它们(例如?q=ipod
或?q=video
) ,这些记录确实会出现
我们所有的新字段都是用indexed=true
它们定义的,所以我不确定为什么如果我们查询它们,我们自己的记录根本不会出现。
任何想法如何调试这种行为?
更新- 添加 schema.xml 和 solrconfig.xml 详细信息。
schema.xml 与 solr 3.6 附带的默认 schema.xml 几乎相同,但添加了以下字段:
<fields>
<field name="search_title" type="text_general" indexed="true" stored="true" multiValued="true"/>
<field name="search_prefix" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="search_description" type="text_general" indexed="true" stored="true" multiValued="true"/>
<field name="search_content" type="text_general" indexed="true" stored="true" multiValued="true"/>
<field name="product_date" type="date" indexed="true" stored="true" multiValued="true"/>
<field name="product_thumbnail" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="product_type" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="product_updatepricefunction" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="tagids" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="tagid" type="string" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_tag" type="string" indexed="true" stored="true"/>
<field name="event_id" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="activity_id" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="activity_function_code" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="search_room" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="weekday" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="activity_weekday" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="activity_begindate" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="activity_begintime" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="activity_endtime" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="audience" type="text_general" indexed="true" stored="true" multiValued="true"/>
<field name="format" type="text_general" indexed="true" stored="true" multiValued="true"/>
<field name="publish_date" type="date" indexed="true" stored="true" multiValued="true"/>
<field name="isbn" type="string" indexed="true" stored="true" multiValued="true" />
<field name="product_code" type="string" indexed="true" stored="true" required="true"/>
</fields>
<uniqueKey>product_code</uniqueKey>
这是来自 solrconfig.xml 的请求处理程序:
<requestHandler name="/select" class="solr.SearchHandler">
<!-- default values for query parameters can be specified, these
will be overridden by parameters in the request
-->
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">10</int>
<str name="df">text</str>
</lst>
<!-- In addition to defaults, "appends" params can be specified
to identify values which should be appended to the list of
multi-val params from the query (or the existing "defaults").
-->
<!-- In this example, the param "fq=instock:true" would be appended to
any query time fq params the user may specify, as a mechanism for
partitioning the index, independent of any user selected filtering
that may also be desired (perhaps as a result of faceted searching).
NOTE: there is *absolutely* nothing a client can do to prevent these
"appends" values from being used, so don't use this mechanism
unless you are sure you always want it.
-->
<!--
<lst name="appends">
<str name="fq">inStock:true</str>
</lst>
-->
<!-- "invariants" are a way of letting the Solr maintainer lock down
the options available to Solr clients. Any params values
specified here are used regardless of what values may be specified
in either the query, the "defaults", or the "appends" params.
In this example, the facet.field and facet.query params would
be fixed, limiting the facets clients can use. Faceting is
not turned on by default - but if the client does specify
facet=true in the request, these are the only facets they
will be able to see counts for; regardless of what other
facet.field or facet.query params they may specify.
NOTE: there is *absolutely* nothing a client can do to prevent these
"invariants" values from being used, so don't use this mechanism
unless you are sure you always want it.
-->
<!--
<lst name="invariants">
<str name="facet.field">cat</str>
<str name="facet.field">manu_exact</str>
<str name="facet.query">price:[* TO 500]</str>
<str name="facet.query">price:[500 TO *]</str>
</lst>
-->
<!-- If the default list of SearchComponents is not desired, that
list can either be overridden completely, or components can be
prepended or appended to the default list. (see below)
-->
<!--
<arr name="components">
<str>nameOfCustomComponent1</str>
<str>nameOfCustomComponent2</str>
</arr>
-->
</requestHandler>