0

I want to make a people index in Redis, containing all values from table a css table.

I imported the following CSV file:

ID,name,tot_cred,salary,type,dept_name,dept_building,dept_budget
98988,Tanaka,120,NULL,student,Biology,Watson,90000.00
76766,Crick,NULL,72000.00,instructor,Biology,Watson,90000.00
00128,Zhang,102,NULL,student,"Comp. Sci.",Taylor,100000.00
12345,Shankar,32,NULL,student,"Comp. Sci.",Taylor,100000.00
54321,Williams,54,NULL,student,"Comp. Sci.",Taylor,100000.00
76544,Brown,58,NULL,student,"Comp. Sci.",Taylor,100000.00
10101,Srinivasan,NULL,65000.00,instructor,"Comp. Sci.",Taylor,100000.00
45565,Katz,NULL,75000.00,instructor,"Comp. Sci.",Taylor,100000.00
83821,Brandt,NULL,92000.00,instructor,"Comp. Sci.",Taylor,100000.00
76653,Aoi,60,NULL,student,"Elec. Eng.",Taylor,85000.00
98765,Bourikas,98,NULL,student,"Elec. Eng.",Taylor,85000.00
98345,Kim,NULL,80000.00,instructor,"Elec. Eng.",Taylor,85000.00
23121,Chavez,110,NULL,student,Finance,Painter,120000.00
12121,Wu,NULL,90000.00,instructor,Finance,Painter,120000.00
76543,Singh,NULL,80000.00,instructor,Finance,Painter,120000.00
19991,Brandt,80,NULL,student,History,Painter,50000.00
32343,"El Said",NULL,60000.00,instructor,History,Painter,50000.00
58583,Califieri,NULL,62000.00,instructor,History,Painter,50000.00
55739,Sanchez,38,NULL,student,Music,Packard,80000.00
15151,Mozart,NULL,40000.00,instructor,Music,Packard,80000.00
44553,Peltier,56,NULL,student,Physics,Watson,70000.00
45678,Levy,46,NULL,student,Physics,Watson,70000.00
70557,Snow,0,NULL,student,Physics,Watson,70000.00
22222,Einstein,NULL,95000.00,instructor,Physics,Watson,70000.00
33456,Gold,NULL,87000.00,instructor,Physics,Watson,70000.00

using: riot-file import /path/people_table.csv --header hmset --keyspace people --keys ID This seemed to be working fine, since keys * and hgetall gave me good results.

After this, I created an index, using

 FT.CREATE people-idx ON HASH PREFIX 1 “people:” SCHEMA name TEXT tot_cred NUMERIC salary NUMERIC type TEXT dept_name TEXT dept_building TEXT dept_budget NUMERIC

The result simply said "OK" so I assumed it was fine. However, when I use ft.search people-idx * or any other query, the result is simply 1) (integer) 0

Everything seems to work except ft.search, so I am confused about what the problem is. Someone please help me.

Imme
  • 15
  • 4
  • 1
    This is probably indexing failures. You can see how many there are by running FT.INFO on you index. Look for hash_indexing_failures. This will tell you how many things failed to index. My guess is that the values of NULL are not numeric and that is resulting in errors. – Guy Royse Mar 07 '23 at 18:07
  • @GuyRoyse hash indexing failures is 0. I've tried getting rid of the null values by changing all of them to 0 anyway, but the problem remains – Imme Mar 07 '23 at 18:23
  • I notice in your examples you use quotes. And those quotes are not the "ASCII ones" but the “fancy ones”. When I try it with the fancy quotes, the PREFIX includes them and since Hashes aren't stored in `“people:”1234` but `people:1234`, it won't index them. When I try it with the ASCII quotes, it works fine. I realize that the fancy quotes may be a copy-and-paste phenomenon, but if they're not, that's your problem. Regardless, you should need quotes at all for what you are doing. – Guy Royse Mar 08 '23 at 14:40

0 Answers0