Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在CQL中使用solr_查询时选择非键列_Solr_Cassandra_Datastax_Datastax Enterprise - Fatal编程技术网

在CQL中使用solr_查询时选择非键列

在CQL中使用solr_查询时选择非键列,solr,cassandra,datastax,datastax-enterprise,Solr,Cassandra,Datastax,Datastax Enterprise,我最近下载了DataStax Enterprise sandbox VM for VirtualBox,以便了解即将到来的项目的信息检索。数据存储堆栈对我来说是全新的,所以我正在尽我最大的努力在深入解决问题之前尽可能多地学习 沙箱环境:Centos 6.6 DSE 4.7.2 我们希望能够使用DataStax Java驱动程序使用solr_查询机制执行CQL查询。如果我们做不到这一点,我们将依靠Solrj 那么,关于我的问题;我已经生成了一个小样本表,其中包含4个字段(upc,name,bran

我最近下载了DataStax Enterprise sandbox VM for VirtualBox,以便了解即将到来的项目的信息检索。数据存储堆栈对我来说是全新的,所以我正在尽我最大的努力在深入解决问题之前尽可能多地学习

沙箱环境:Centos 6.6 DSE 4.7.2

我们希望能够使用DataStax Java驱动程序使用solr_查询机制执行CQL查询。如果我们做不到这一点,我们将依靠Solrj

那么,关于我的问题;我已经生成了一个小样本表,其中包含4个字段(
upc
name
brand
description
),其中3个是Cassandra中主键的一部分。当我创建一个Solr核心并使用CQL插入数据时,使用Solr管理查询控制台搜索数据似乎没有问题。不幸的是,当我尝试使用solr_查询创建CQL语句时,我只能选择作为Cassandra主键一部分的字段。如果我执行
选择*
或例如
选择说明
说明
不是主键的一部分),则会出现以下错误:

Undefined name ttl(description) in selection clause))
以下是CQL:

从catalog.item中选择upc、名称、品牌、说明
其中solr_query='{“q”:“name:Milk*”}'

有趣的是,如果我使用
token()
函数,我可以很好地得到一个结果集:

从catalog.item中选择upc、名称、品牌、说明

其中token(upc)>=-9223372036854775808和token(upc)您好Stephen,您所做的看起来还可以(您不必使用token()-出于好奇,您是否使用DevCenter(特别是1.4)要执行这些查询?不久前,DevCenter中存在导致此错误的错误,但在最新版本中已修复。此外,您始终可以使用dsetool生成Solr资源(core,schema/config.xml)-啊!我觉得很傻。这是在DevCenter中。从cqlsh执行查询效果很好。谢谢!嗨,Stephen,很高兴它为你解决了问题-如果你想用一些很酷的东西来打发时间,下面是我制作的一个快速而肮脏的演示-它让你熟悉dsetool,并启用了地理空间搜索等功能,还可以提前键入:您好,Stephen,您所做的看起来还可以(您不必使用token()-出于好奇,您是否使用DevCenter(特别是1.4)来执行这些查询?不久前,DevCenter中存在导致此错误的错误,但在最新版本中已得到修复。此外,您始终可以使用dsetool生成Solr资源(core,schema/config.xml)-啊!我觉得很傻。这是在DevCenter中。从cqlsh执行查询效果很好。谢谢!嗨,Stephen,很高兴它为你解决了问题-如果你想用一些很酷的东西来打发时间,下面是我制作的一个快速而肮脏的演示-它让你熟悉dsetool,并启用了地理空间搜索等功能,还可以提前键入:
CREATE KEYSPACE catalog WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };

USE catalog;

create table item (
  upc INT,
  name TEXT,
  brand TEXT,
  description TEXT,
  PRIMARY KEY ((upc), name, brand)
);
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="product_catalog" version="1.5">
 <types>
  <fieldType name="int" class="solr.TrieIntField"/>
  <fieldType name="string" class="solr.StrField"/>
  <fieldType name="text" class="solr.TextField">
    <analyzer><tokenizer class="solr.StandardTokenizerFactory"/></analyzer>
  </fieldType>
 </types>
 <fields>
    <field name="upc" type="int" indexed="true" stored="true" docValues="true"/>
    <field name="name" type="string" indexed="true" stored="true" docValues="true"/>
    <field name="brand" type="string" indexed="true" stored="true" docValues="true"/>
    <field name="description" type="text" indexed="true" stored="true"/>
 </fields>

<uniqueKey>(upc,name,brand)</uniqueKey>

</schema>
insert into catalog.item (upc, name, brand, description)
values (1001, 'Milk', 'Local Company', 'The best local milk in the area.');
insert into catalog.item (upc, name, brand, description)
values (1002, 'The Other Milk', 'The Other Brand', 'The cheaper, but not local milk.');
insert into catalog.item (upc, name, brand, description)
values (1003, 'Milky Way', 'Mars', 'A chocolate, caramel candy bar.');
insert into catalog.item (upc, name, brand, description)
values (1004, 'Milk Dubs', 'Hersheys', 'Bit-size caramel pieces covered in chocolate.');
insert into catalog.item (upc, name, brand, description)
values (1005, 'Almond Joy', 'Mars', 'Creamy coconut wafers dipped in chocolate with an almond on top.');
insert into catalog.item (upc, name, brand, description)
values (1006, 'Almonds', 'The Almond Company', 'Salted roasted almonds.');
insert into catalog.item (upc, name, brand, description)
values (1007, 'Unsalted Almonds', 'The Almond Company', 'Plain roasted almonds.');