Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/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
Cassandra 卡桑德拉用层状Lucene_Cassandra_Lucene_Stratio - Fatal编程技术网

Cassandra 卡桑德拉用层状Lucene

Cassandra 卡桑德拉用层状Lucene,cassandra,lucene,stratio,Cassandra,Lucene,Stratio,我是Lucene的新手。刚刚开始。我有几个基本问题: 如何查看使用Stratio Lucene创建的所有索引 如何删除使用Stratio Lucene创建的索引 两者的区别是什么 fields: { fld_1: {type: "string"}, fld_2: {type: "text"} } 类型:“字符串”和类型:“文本” 我之所以要求差异,是因为我在尝试创建第一个lucene索引时遇到了一个错误。我在Cassandra中的专栏是这样的:“fld_1文本”,但

我是Lucene的新手。刚刚开始。我有几个基本问题:

  • 如何查看使用Stratio Lucene创建的所有索引

  • 如何删除使用Stratio Lucene创建的索引

  • 两者的区别是什么

    fields: {
         fld_1: {type: "string"},
         fld_2: {type: "text"}
     }
    
类型:“字符串”和类型:“文本”

我之所以要求差异,是因为我在尝试创建第一个lucene索引时遇到了一个错误。我在Cassandra中的专栏是这样的:“fld_1文本”,但当我试图在上面的fld_1上创建和索引时,它抛出了一个异常

ConfigurationException: 'schema' is invalid : Unparseable JSON schema: Unexpected character ('}' (code 125)): was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name
at [Source: {
fields: {
Lucene索引脚本:

CREATE CUSTOM INDEX lucene_index ON testTable ()
USING 'com.stratio.cassandra.lucene.Index'
WITH OPTIONS = {
   'refresh_seconds': '1',
   'schema': '{
fields: {
     fld_1: {type: "string"},
     fld_2: {type: "string"},
     id: {type: "integer"},
     test_timestamp: {type: "date", pattern: "yyyy/MM/dd HH:mm:ss"}
  }
}'
};

谢谢

首先:您不能只查看Stratio Lucene索引,下面的查询将显示所有索引

SELECT * FROM system."IndexInfo"; 
第二:您可以使用
DROP index\u name
命令删除索引。i、 e

DROP INDEX test;
第三:在Stratio-Lucene索引中,字符串是未分析的文本值,文本是根据指定的分析器分析的语言感知文本值

这意味着,如果将字段指定为字符串,它将直接索引和查询。但是如果您使用文本,那么它将首先由指定的分析器进行分析,默认值为
default\u analyzer
org.apache.lucene.analysis.standard.StandardAnalyzer
),然后索引和查询

编辑:

您必须首先在cassandra中创建一个文本字段,然后在创建索引时指定它

例如:

ALTER TABLE testtable ADD lucene text;

CREATE CUSTOM INDEX lucene_index ON testTable (lucene) USING 'com.stratio.cassandra.lucene.Index'
WITH OPTIONS = {
   'refresh_seconds': '1',
   'schema': '{
     fields: {
         fld_1: {type: "string"},
         fld_2: {type: "string"},
         id: {type: "integer"},
         test_timestamp: {type: "date", pattern: "yyyy/MM/dd HH:mm:ss"}
     }
   }'
};

更多信息:

感谢您的回复。我用更多的信息更新了这个问题。我是按照你提到的页面上的例子做的。你能解释一下吗?你用的是哪一个cassandra和stratio索引版本,把你用来创建索引的模式放到cassandra 3.10和stratio 3.10中去。顺便问一下,如果你用的是cassandra 3.10,为什么不用SASIIndex呢