[sqlite] matchinfo example does not work as documented
According do http://www.sqlite.org/fts3.html#matchinfo sqlite3 test.sqlite3 CREATE VIRTUAL TABLE t1 USING fts4(a, b); INSERT INTO t1 VALUES('transaction default models default', 'Non transaction reads'); INSERT INTO t1 VALUES('the default transaction', 'these semantics present'); INSERT INTO t1 VALUES('single request', 'default data'); SELECT matchinfo(t1) FROM t1 WHERE t1 MATCH 'default transaction these semantics'; Should result in: 3 2 1 3 2 0 1 1 1 2 2 0 1 1 0 0 0 1 1 1 However, I get back an empty string. SELECT matchinfo(t1, 'ns') FROM t1 WHERE t1 MATCH 'default transaction'; returns two empty strings sqlite3 --version 3.7.13 2012-06-11 02:05:22 f5b5a13f7394dc143aa136f1d4faba6839eaa6dc AJ ONeal ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] matchinfo example does not work as documented
On Sat, Jul 21, 2012 at 2:05 PM, AJ ONeal coola...@gmail.com wrote: According do http://www.sqlite.org/fts3.html#matchinfo sqlite3 test.sqlite3 CREATE VIRTUAL TABLE t1 USING fts4(a, b); INSERT INTO t1 VALUES('transaction default models default', 'Non transaction reads'); INSERT INTO t1 VALUES('the default transaction', 'these semantics present'); INSERT INTO t1 VALUES('single request', 'default data'); SELECT matchinfo(t1) FROM t1 WHERE t1 MATCH 'default transaction these semantics'; matchinfo returns a blob. Try running hex(matchinfo(t1)) so that you can see the blob content. Should result in: 3 2 1 3 2 0 1 1 1 2 2 0 1 1 0 0 0 1 1 1 However, I get back an empty string. SELECT matchinfo(t1, 'ns') FROM t1 WHERE t1 MATCH 'default transaction'; returns two empty strings sqlite3 --version 3.7.13 2012-06-11 02:05:22 f5b5a13f7394dc143aa136f1d4faba6839eaa6dc AJ ONeal ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] matchinfo example does not work as documented
On Sat, Jul 21, 2012 at 3:39 PM, AJ ONeal coola...@gmail.com wrote: matchinfo returns a blob. Try running hex(matchinfo(t1)) so that you can see the blob content. Now I see a number which matches my expectations: SELECT hex(matchinfo(t1)) FROM t1 WHERE t1 MATCH 'default transaction these semantics'; 030002000100030002000100010001000200020001000100010001000100 Will you update the documentation with this information? What information do you propose to add to the documentation? I would submit a pull request myself, but I'm not familiar with fossil. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] matchinfo example does not work as documented
Now I see a number which matches my expectations: SELECT hex(matchinfo(t1)) FROM t1 WHERE t1 MATCH 'default transaction these semantics'; 030002000100030002000100010001000200020001000100010001000100 Will you update the documentation with this information? What information do you propose to add to the documentation? That in order to see the data the hex() function must be used. I imagine that most users who are following this documentation for the first time are using the sqlite3 binary and following along by copying and pasting the examples. AJ ONeal ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] matchinfo example does not work as documented
Specifically: -- The next set of three integers (0 1 1) pertain to the hits for default -- in column 1 of the table (0 in this row, 1 in all rows, spread across -- 1 rows). -- SELECT matchinfo(t1) FROM t1 WHERE t1 MATCH 'default transaction these semantics'; -- the blob appears as an empty string. To view an ascii representation, use hex() SELECT hex(matchinfo(t1)) FROM t1 WHERE t1 MATCH 'default transaction these semantics'; 0300020001000300020001000100100020002000100010010001000100 AJ ONeal On Sat, Jul 21, 2012 at 2:06 PM, AJ ONeal coola...@gmail.com wrote: Now I see a number which matches my expectations: SELECT hex(matchinfo(t1)) FROM t1 WHERE t1 MATCH 'default transaction these semantics'; 030002000100030002000100010001000200020001000100010001000100 Will you update the documentation with this information? What information do you propose to add to the documentation? That in order to see the data the hex() function must be used. I imagine that most users who are following this documentation for the first time are using the sqlite3 binary and following along by copying and pasting the examples. AJ ONeal ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] matchinfo example does not work as documented
On Sat, Jul 21, 2012 at 4:06 PM, AJ ONeal coola...@gmail.com wrote: Now I see a number which matches my expectations: SELECT hex(matchinfo(t1)) FROM t1 WHERE t1 MATCH 'default transaction these semantics'; 030002000100030002000100010001000200020001000100010001000100 Will you update the documentation with this information? What information do you propose to add to the documentation? That in order to see the data the hex() function must be used. I imagine that most users who are following this documentation for the first time are using the sqlite3 binary and following along by copying and pasting the examples. Read the documentation carefully: http://www.sqlite.org/fts3.html#matchinfo. Right the first paragraph: The matchinfo function returns a blob value. If it is used within a query that does not use the full-text index (a query by rowid or linear scan), then the blob is zero bytes in size. Otherwise, the blob consists of zero or more 32-bit unsigned integers in machine byte-order. What part of this paragraph makes you believe that if you print the result of matchinfo as text you will see something meaningful? Pavel ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] matchinfo example does not work as documented
Read the documentation carefully: http://www.sqlite.org/fts3.html#matchinfo. Right the first paragraph: The matchinfo function returns a blob value. If it is used within a query that does not use the full-text index (a query by rowid or linear scan), then the blob is zero bytes in size. Otherwise, the blob consists of zero or more 32-bit unsigned integers in machine byte-order. What part of this paragraph makes you believe that if you print the result of matchinfo as text you will see something meaningful? The part where it shows output in the comments of the example that, according to common conventions used in documentation, would indicate it is the output of the function (which it is, just not the user-viewable output). Plenty of languages (javascript, ruby, python, etc, etc, etc) pretty-print native objects when they are to be represented as text. What about that paragraph indicates that the sqlite3 cli doesn't know how to pretty-print understand its own native types? AJ ONeal ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] matchinfo example does not work as documented
On Sat, Jul 21, 2012 at 7:35 PM, AJ ONeal coola...@gmail.com wrote: Read the documentation carefully: http://www.sqlite.org/fts3.html#matchinfo. Right the first paragraph: The matchinfo function returns a blob value. If it is used within a query that does not use the full-text index (a query by rowid or linear scan), then the blob is zero bytes in size. Otherwise, the blob consists of zero or more 32-bit unsigned integers in machine byte-order. What part of this paragraph makes you believe that if you print the result of matchinfo as text you will see something meaningful? The part where it shows output in the comments of the example that, according to common conventions used in documentation, would indicate it is the output of the function (which it is, just not the user-viewable output). Where did you see that? Could you cite it? All I see is -- ... If each block of 4 bytes in the blob is interpreted -- as an unsigned integer in machine byte-order, the values will be: -- -- 3 2 1 3 2 0 1 1 1 2 2 0 1 1 0 0 0 1 1 1 So it's clearly says: you have to interpret it, it's not like you just print it as string. Plenty of languages (javascript, ruby, python, etc, etc, etc) pretty-print native objects when they are to be represented as text. What about that paragraph indicates that the sqlite3 cli doesn't know how to pretty-print understand its own native types? sqlite3 cli understand its native type which is BLOB. But how should it pretty-print it? BLOB can contain absolutely any information and it's not its job to parse SQL to try to understand what this blob can actually contain. Pavel ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] matchinfo example does not work as documented
Not everyone who uses the sqlite docs is a 1337 c guru. Most of them are probably rubyists, pythonistas, some php script kiddies, and, as of late, android and ios devs (some of which are a bit more leet). Monkey see, monkey do. If I see output in comments, I expect the same output when I run the code. It wasn't clear to me, it's obviously very clear to you. I think the docs could be better, more eye-catching on the important points: -- NOTE: blobs print as empty strings in the sqlite3 cli, if you want to see debug output use hex(). -- NOTE: this isn't what the output you see looks like, it's been hand-formatted for easy-reading But y'all do whatcha gon' do. AJ ONeal On Sat, Jul 21, 2012 at 6:22 PM, Pavel Ivanov paiva...@gmail.com wrote: On Sat, Jul 21, 2012 at 7:35 PM, AJ ONeal coola...@gmail.com wrote: Read the documentation carefully: http://www.sqlite.org/fts3.html#matchinfo. Right the first paragraph: The matchinfo function returns a blob value. If it is used within a query that does not use the full-text index (a query by rowid or linear scan), then the blob is zero bytes in size. Otherwise, the blob consists of zero or more 32-bit unsigned integers in machine byte-order. What part of this paragraph makes you believe that if you print the result of matchinfo as text you will see something meaningful? The part where it shows output in the comments of the example that, according to common conventions used in documentation, would indicate it is the output of the function (which it is, just not the user-viewable output). Where did you see that? Could you cite it? All I see is -- ... If each block of 4 bytes in the blob is interpreted -- as an unsigned integer in machine byte-order, the values will be: -- -- 3 2 1 3 2 0 1 1 1 2 2 0 1 1 0 0 0 1 1 1 So it's clearly says: you have to interpret it, it's not like you just print it as string. Plenty of languages (javascript, ruby, python, etc, etc, etc) pretty-print native objects when they are to be represented as text. What about that paragraph indicates that the sqlite3 cli doesn't know how to pretty-print understand its own native types? sqlite3 cli understand its native type which is BLOB. But how should it pretty-print it? BLOB can contain absolutely any information and it's not its job to parse SQL to try to understand what this blob can actually contain. Pavel ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users