我正在使用Apache Solr ..我有以下场景..:
我的PostGreSQL数据库中有两个表.一个是" 汽车 ".其他是" 经销商 "
现在我有一个汽车的数据配置文件,如下所示:
<document name="offerings">
<entity name="jc_offerings" query="select * from jc_offerings" >
<field column="id" name="id" />
<field column="name" name="name" />
<field column="display_name" name="display_name" />
<field column="extra" name="extra" />
</entity>
</document>
Run Code Online (Sandbox Code Playgroud)
我有一个类似的数据 - " 经销商 "的config.xml .它与汽车具有相同的字段:名称,额外等
现在在我的Schema.xml中,我定义了以下字段:
<fields>
<field name="id" type="string" indexed="true" />
<field name="name" type="name" indexed="true" />
<field name="extra" type="extra" indexed="true" />
<field name="CarsText" type="text_general" indexed="true"
stored="true" multiValued="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>CarsText</defaultSearchField>
<copyField source="name" dest="CarsText"/>
<copyField source="extra" dest="CarsText"/>
Run Code Online (Sandbox Code Playgroud)
现在我想搜索:"其中名称是Maruti"..那么Solr将如何知道是否搜索:::汽车领域:名称或经销商字段"名称".. ?? …
我想从Solr得到一组结果,其中多值字段不为空.这可能吗?谢谢!
我正在使用apache Solr搜索我的数据库.. !!
假设我已经从我的一个表中索引了4列.. !! ..我只是想要只返回包含我的查询词的那些列作为响应.. !! ..是可能的.. ??
例如 :
我有一个带列的桌车:名字,displayName,描述,额外 .. !!
现在我进行查询,例如:
localhost:8983/solr/select?q=maruti&wt=json
Run Code Online (Sandbox Code Playgroud)
现在有些行中只有名称 可能包含" maruti " 这个词
所以,作为回报,我只想要名称(以及其他一些固定字段,如ID)..
同样,如果描述包含这个词,那么只应该返回描述 ..而不是其他列.. !!
我怎么能实现这个.. ??