You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/managed-instance-apache-cassandra/search-lucene-index.md
+24-23Lines changed: 24 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ Cassandra Lucene Index, derived from Stratio Cassandra, is a plugin for Apache C
27
27
- Deploy an Azure Managed Instance for Apache Cassandra cluster. You can do this via the [portal](create-cluster-portal.md) - Lucene indexes will be enabled by default.
28
28
- Connect to your cluster from [CQLSH](create-cluster-portal.md#connecting-from-cqlsh).
29
29
30
-
## Create keyspace and table with Lucene Index
30
+
## Create data with Lucene Index
31
31
32
32
1. In your `CQLSH` command window, create a keyspace and table as below:
33
33
@@ -64,9 +64,7 @@ Cassandra Lucene Index, derived from Stratio Cassandra, is a plugin for Apache C
@@ -76,13 +74,34 @@ Insert the following sample tweets:
76
74
INSERT INTO tweets (id,user,body,time,latitude,longitude) VALUES (5,'quetzal','Click my link, like my stuff!', '2023-04-01T11:21:59.001+0000', 40.3930, -3.7329);
77
75
```
78
76
77
+
## Controlling read consistency
78
+
79
+
1. The index you created earlier will index all the columns in the table with the specified types, and it will be refreshed once per second. Alternatively, you can explicitly refresh all the index shards with an empty search with consistency ALL:
80
+
81
+
```SQL
82
+
CONSISTENCY ALL
83
+
SELECT * FROM tweets WHERE expr(tweets_index, '{refresh:true}');
84
+
CONSISTENCY QUORUM
85
+
```
86
+
79
87
1. Now, you can search for tweets within a certain date range:
80
88
81
89
```SQL
82
90
SELECT * FROM tweets WHERE expr(tweets_index, '{filter: {type: "range", field: "time", lower: "2023/03/01", upper: "2023/05/01"}}');
83
91
```
84
92
85
-
1. Now, to search the top 100 more relevant tweets where body field contains the phrase “Click my link” within the aforementioned date range:
93
+
1. This search can also be performed by forcing an explicit refresh of the involved index shards:
1. To search the top 100 more relevant tweets where body field contains the phrase “Click my link” within the aforementioned date range:
86
105
87
106
```SQL
88
107
SELECT * FROM tweets WHERE expr(tweets_index, '{
@@ -147,24 +166,6 @@ Insert the following sample tweets:
147
166
}') limit 100;
148
167
```
149
168
150
-
1. The index you created earlier will index all the columns in the table with the specified types, and it will be refreshed once per second. Alternatively, you can explicitly refresh all the index shards with an empty search with consistency ALL:
151
-
152
-
```SQL
153
-
CONSISTENCY ALL
154
-
SELECT * FROM tweets WHERE expr(tweets_index, '{refresh:true}');
155
-
CONSISTENCY QUORUM
156
-
```
157
-
158
-
1. The same search can be performed forcing an explicit refresh of the involved index shards:
0 commit comments