Recent

Author Topic: $20 Task: Full Text Search in SQLite  (Read 3642 times)

paweld

  • Hero Member
  • *****
  • Posts: 1003
Re: $20 Task: Full Text Search in SQLite
« Reply #15 on: March 04, 2024, 12:53:02 pm »
no, for SQLdb. For ZEOS all are Memo
Best regards / Pozdrawiam
paweld

Zvoni

  • Hero Member
  • *****
  • Posts: 2327
Re: $20 Task: Full Text Search in SQLite
« Reply #16 on: March 04, 2024, 01:11:20 pm »
no, for SQLdb. For ZEOS all are Memo

Just did a test with an FTS5-Table

I added the text of the first post of this thread to the FTS5-table.
it's 1558 characters(?) in Length

I added a single line in sqlite3conn in AddFieldDefs-Method
Code: Pascal  [Select][+][-]
  1. if FT=ftUnknown then
  2.       case TStorageType(sqlite3_column_type(st,i)) of
  3.         stInteger: FT:=ftLargeInt;
  4.         stFloat:   FT:=ftFloat;
  5.         stBlob:    FT:=ftBlob;
  6.         stText:    FT:=ftMemo;  //THIS ONE WAS ADDED
  7.         else       FT:=ftString;
  8.       end;                  

Using "standard" sqlite3conn with sqldb, i executed a "SELECT * FROM MyFTS5Table" with a TSQLQuery-Object.
It returned the full text.
A writeln(Length(MyQuery.Fields[0].AsString)); returend 1558

and a Writeln(MyQuery.Fields[0].DataType);  returns ftMemo :)
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

paweld

  • Hero Member
  • *****
  • Posts: 1003
Re: $20 Task: Full Text Search in SQLite
« Reply #17 on: March 04, 2024, 01:23:12 pm »
Best regards / Pozdrawiam
paweld

Zvoni

  • Hero Member
  • *****
  • Posts: 2327
Re: $20 Task: Full Text Search in SQLite
« Reply #18 on: March 04, 2024, 01:25:25 pm »
@Zvoni: Can you add a patch on https://gitlab.com/freepascal.org/fpc/source/-/issues
Would love to, but have never done that.
Nevermind, that i'm at my company laptop, and i don't have diff-app there.

Though, shouldn't that be tested beforehand? That was just a quick and dirty way to determine what the Fieldtype of an FTS5-Column really is.
No idea if it affects anything else

btw: I just did the opposite test (removed that one line) with the Text from the first post

I confirm your findings:
Fields[0].DataSize returns 1021
« Last Edit: March 04, 2024, 01:29:33 pm by Zvoni »
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

TRon

  • Hero Member
  • *****
  • Posts: 2515
Re: $20 Task: Full Text Search in SQLite
« Reply #19 on: March 07, 2024, 02:19:18 am »
fwiw something similar was done in fixes for odbcconnection here

paweld

  • Hero Member
  • *****
  • Posts: 1003
Re: $20 Task: Full Text Search in SQLite
« Reply #20 on: March 07, 2024, 12:49:12 pm »
@TRon: thank you.

@Zvoni: Based on a commit from link shared by @TRon, I think you can add a issue with a patch.
Best regards / Pozdrawiam
paweld

Zvoni

  • Hero Member
  • *****
  • Posts: 2327
Re: $20 Task: Full Text Search in SQLite
« Reply #21 on: March 07, 2024, 03:47:29 pm »
@TRon: thank you.

@Zvoni: Based on a commit from link shared by @TRon, I think you can add a issue with a patch.
That's exactly my problem: Never created a patch :)
Could/Would you?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Zvoni

  • Hero Member
  • *****
  • Posts: 2327
Re: $20 Task: Full Text Search in SQLite
« Reply #22 on: March 08, 2024, 11:58:46 am »
@TRon: thank you.

@Zvoni: Based on a commit from link shared by @TRon, I think you can add a issue with a patch.
https://gitlab.com/freepascal.org/fpc/source/-/issues/40686
My first one :)
Though no patch....
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: $20 Task: Full Text Search in SQLite
« Reply #23 on: March 08, 2024, 12:03:37 pm »
Already fixed by MvC. Open source at its best...

Zvoni

  • Hero Member
  • *****
  • Posts: 2327
Re: $20 Task: Full Text Search in SQLite
« Reply #24 on: March 08, 2024, 12:10:55 pm »
Already fixed by MvC. Open source at its best...
We might get pawel to move his FTS-Stuff from Zeos to FPC-regular components? *gg*
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

TRon

  • Hero Member
  • *****
  • Posts: 2515
Re: $20 Task: Full Text Search in SQLite
« Reply #25 on: March 08, 2024, 09:24:44 pm »
Thank you for the report Zvoni, paweld for the help  and ofc MvC for the commit  8)

Indeed open source at its best  :)

paweld

  • Hero Member
  • *****
  • Posts: 1003
Re: $20 Task: Full Text Search in SQLite
« Reply #26 on: March 09, 2024, 08:19:37 am »
@Zvoni: Thank you.The sqldb versions - one with htmlviewer, the other with ipro - are attached. Of course, all text will be visible after compilation with the current fpc trunk
Best regards / Pozdrawiam
paweld

 

TinyPortal © 2005-2018