在Solr中索引和查询CQL3集合映射 [英] Indexing and querying CQL3 collection map in Solr

查看:335
本文介绍了在Solr中索引和查询CQL3集合映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下文档页来自Datastax状态:

  DSE Search如下映射集合:
集合列表和集:值字段
集合映射:动态字段
动态字段的名称减去通配符是映射名称。例如,映射列名称dyna *映射到dyna。内部键映射到完整的字段名称。

最后一句话对我来说不是很清楚。字段定义应该怎么样?假设我有一个在CQL3中定义为 score map 的集合映射,以下字段定义是否正确?

 < field name =scores *type =intindexed =truestored =true/> 

如何查询?假设映射的值是 {201409:89,201410:67} ,并且我要过滤内部字段'201410',以下是正确的:

  fq = scores201410:[80 TO *] 


解决方案

动态字段减去通配符的名称是映射名称,表示以下动态字段对应于CQL中的以下映射名称:



动态字段:< dynamicField name =lang_ *。 。 。 >
map name: CREATE TABLE hits(。.lang_ map< text,text> ...); / p>

在您的示例中,动态字段name = scores _ *。



查询取决于您插入到字段。如果您将这些值插入到CQL scores_列中:

  {'scores_100':'5000'} 
{ scores_200':'10000'}
{'scores_100':'300'}

,我认为集合中的所有scores_100的查询将是:



http://:8983 / solr / mykeyspace.myscores / select?q = scores_100% 3A *& wt = xml& indent = true


The following documentation page from Datastax states:

DSE Search maps collections as follows:
     Collection list and set: multi-valued field
     Collection maps: dynamic field
The name of the dynamic field minus the wildcard is the map name. For example, a map column name dyna* is mapped to dyna. Inner keys are mapped to the full field name.

The last statement is not very clear to me. How exactly should the field definition look like? Assuming that I have a collection map defined as scores map<int,int> in CQL3, is the following field definition correct?

<field name="scores*" type="int" indexed="true" stored="true"/>

And how do I query this? Assuming that the map's value is {201409 : 89, 201410 : 67} and I want to filter on inner field '201410', is the following correct?:

fq=scores201410:[80 TO *]

解决方案

The name of the dynamic field minus the wildcard is the map name means that the following dynamic field corresponds to the following map name in CQL:

dynamic field: <dynamicField name="lang_*" . . . > map name: CREATE TABLE hits ( . . .lang_ map<text, text>, . . .);

In your example, dynamic field name = scores_*.

The query depends on the values you insert into the fields. If you insert these values into the CQL scores_ column:

{ 'scores_100'  : '5000'}
 { 'scores_200'  : '10000'}
 { 'scores_100'  : '300'}

then, I think the query to get all the scores_100 in the collection would be:

http://:8983/solr/mykeyspace.myscores/select?q=scores_100%3A*&wt=xml&indent=true

这篇关于在Solr中索引和查询CQL3集合映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆