1、如果需要同时在title和content中进行查询,可以添加如下字段:
<field name="title_content" type="textComplex" indexed="true" stored="false" multiValued="true"/>
<copyField source="my_title" dest="title_content"/>
<copyField source="my_content" dest="title_content"/>
其中:title_content为新定义的查询字段,如果需要同时在title和content中进行查询,那么就使用这个查询字段

2、设置默认查询字段,这样的话就不需要在Query中进行查询时使用my_title:hello这样的格式

将solrconfig.xml中得 <str name="df">text</str>
修改为: <str name="df">title_content</str>

这样,如果需要查询内容在标题字段或内容字段出现的结果的时候,只需要在查询条件中填写hello就可以了

扫扫关注“茶爸爸”微信公众号
solr4.x设置默认查询字段
坚持最初的执着,从不曾有半点懈怠,为优秀而努力,为证明自己而活。
回复:"茶爸爸"       看看有什么!!

相关文章:

  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
  • 2021-12-04
  • 2021-11-20
  • 2022-12-23
  • 2021-08-25
  • 2021-07-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-05
  • 2021-07-15
相关资源
相似解决方案