For example, I've keyword for search is: 'Basket Ball'. What is the query that can get all field that contain the 'Basket Ball',.? I've tried to using *:Basket Ball, but it doesn't work,.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
schema.xml defines the default search field -
<defaultSearchField>text</defaultSearchField>
You can copy all the fields to this default search field.
<copyField source="field1" dest="text"/>
<copyField source="field2" dest="text"/>
<copyField source="field3" dest="text"/>
And query q=basket ball
should work.
回答2:
You need to use a query parser which is able to dispatch tokens to several fields, such as (e)dismax. For exemple if you have two fields field1
and field2
: http://solr/select?q={!dismax}Basket Ball&qf=field1^1 field2^1
See http://wiki.apache.org/solr/DisMaxQParserPlugin#qf_.28Query_Fields.29 for more information on dismax configuration.
回答3:
The default search field (since 3.6) is now defined in solrconfig.xml
e.g. In the solrconfig.xml that ships with Solr configsets directory you will see something like
<initParams path="/update/**,/query,/select,/tvrh,/elevate,/spell">
<lst name="defaults">
<str name="df">allText</str>
</lst>
</initParams>
You can change allText
to yourDefaultSearchFieldName