0
我有卡桑德拉表如下数据:DSE卡桑德拉SOLR查询与空格
cqlsh:test> SELECT * FROM test1 WHERE solr_query='{"q":"address:*"}';
name | address | age | solr_query
-------+------------------------------+-----+------------
test3 | road3 united states | 23 | null
test4 | road 123 canada | 23 | null
test2 | street2 united states | 22 | null
test1 | 123 california united states | 21 | null
test5 | 123 Texas united states | 23 | null
与架构:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<schema name="TestSolrSchema" version="1.5">
<types>
<fieldType class="org.apache.solr.schema.StrField" name="StrField"/>
<fieldType class="org.apache.solr.schema.TrieIntField" name="TrieIntField"/>
</types>
<fields>
<field docValues="true" indexed="true" multiValued="false" name="name" stored="true" type="StrField"/>
<field docValues="true" indexed="true" multiValued="false" name="address" stored="true" type="StrField"/>
<field docValues="true" indexed="true" multiValued="false" name="age" stored="true" type="TrieIntField"/>
</fields>
<uniqueKey>name</uniqueKey>
</schema>
与空间字符串的完美搭配工作 cqlsh:测试> SELECT * FROM test1 WHERE solr_query ='{“q”:“address:\”123 california united states \“”}';
name | address | age | solr_query
-------+------------------------------+-----+------------
test1 | 123 california united states | 21 | null
但是,如果我想搜索以“123”开始的字符串(带空格的字符串的正则表达式),它会失败。 (试过其他solr query: {"q":"address:\"123\"*"})
cqlsh:test> SELECT * FROM test1 WHERE solr_query='{"q":"address:\"123\""}';
name | address | age | solr_query
------+---------+-----+------------
(0 rows)
有没有办法让正则表达式的Solr的字符串字段类型来完成与空间?
如果你不介意我问,你是怎么用Solr和Cassandra正确集成的,到目前为止还找不到有用的教程。 – trynacode