mattgodbolt / zindex

Create an index on a compressed text file
BSD 2-Clause "Simplified" License
622 stars 37 forks source link

Can I know how to use --raw? #53

Open crotoc opened 1 year ago

crotoc commented 1 year ago

I indexed a file using zindex by column 4. I want to search for the columns containing a keyword. Can you guys tell me how to use --raw to achieve this. I don't know the default table name and the index name underlying zindex. Please give me some info about this. Thanks!

crotoc commented 1 year ago

Let me answer it by myself.

If you want to use --raw, you need to index your file through a json (--config). My json is like this:

{ "indexes": [ { "type": "field", "delimiter": "\t", "fieldNum": 4, "name":"first" } ] }

The most important value in the json is the "name".

Then I can search by --raw by this way: zq --raw ''select a.line from index_first a where (a.key like "ID" OR a.key like \"%something%\""

Hope this help others.