0

Hi I am storing the email id in Crate Io but while searching i am not able to search because of the @ symbol its not searching the records.is there any solution for this problem?

1 Answers1

1

I am not exactly sure what you mean by "not searching the records".

You can use the LIKE to query string columns, e.g.

cr> create table emails (name string, email string);
CREATE OK (0.152 sec)
cr> insert into emails (name, email) values ('me', 'me@example.com'), ('you', 'you@example.com');
INSERT OK, 2 rows affected (0.017 sec)
cr> select * from emails where email like 'me%';
+----------------+------+
| email          | name |
+----------------+------+
| me@example.com | me   |
+----------------+------+
SELECT 1 row in set (0.013 sec)

or select by email:

cr> select * from emails where email ='me@example.com';
+----------------+------+
| email          | name |
+----------------+------+
| me@example.com | me   |
+----------------+------+
SELECT 1 row in set (0.016 sec)

See Queries in the Crate documentation.

Christian
  • 279
  • 2
  • 8
  • if i am using select * from emails where email ='me@example.com' then result set is empty – Lakesh Kumar Mar 12 '15 at 09:52
  • I just tried: `select * from emails where email ='me@example.com';` and it worked for me. what crate version / operating system / environment do you use? – Christian Mar 12 '15 at 10:39
  • i am making the full text indexing on for email ID .the create query is create table emails (name string, emailid string INDEX using fulltext); – Lakesh Kumar Mar 16 '15 at 06:23
  • you should not used a fulltext index on a plain string field, because it will tokenize the text. what you probably want on your email field is a primary key: `CREATE TABLE emails (name STRING, email STRING PRIMARY KEY),` for fulltext index see: https://crate.io/docs/en/latest/sql/fulltext.html – Christian Mar 16 '15 at 13:41