solr
在schema.xml中。<defaultSearchField>text</defaultSearchField>
如果在localhost/solr/admin中直接搜索文字, 而不是title:xx,
就会搜索这个text域的索引内容。
所以如果我们想直接搜索某个域的索引, 只要修改这里就行了。
================
不可以设置多个
比如
<defaultSearchField>msg_title</defaultSearchField>
<defaultSearchField>msg_content</defaultSearchField>
会导致默认的搜索域为msg_title, 颠倒顺序后就会变成msg_content.
之前的做法是
<defaultSearchField>msg_all</defaultSearchField>
<copyField source="msg_title" dest="msg_all"/>
<copyField source="msg_content" dest="msg_all"/>
但是这样会影响到获取高亮。
比如
List<String> h_title = resp.getHighlighting().get(id)
.get("msg_title");
上面的代码会返回控制。
因为resp里面只有msg_all, 这样就会混淆高亮的显示。
页:
[1]