Using APSW, FTS5Model and trying to search in it fails

10 views
Skip to first unread message

Lujza Lanyi

unread,
Jul 5, 2022, 5:57:35 AMJul 5
to peewee-orm
hi,
I was wondering if someone could help me with my Peewee ORM's models and functions

I am writing a search application in which I want to be able to search in any part of a triplet of the form [head.name, relation, tail.name] and I'm just having trouble to write it correctly. I keep getting mysterious error messages. https://gist.github.com/noxeee/d326251662083348fefd2da72dba1ab5 So this is the code.

Currently when I try to run it it gives me the error apsw.SQLError: SQLError: sub-select returns 5 columns - expected 1 and I'm honestly confused about which part the code this even is, because it only gets thrown when I iterate over the results since everything is returned as iterable. Even debugging this whole thing seems a little hard to me.

Also I don't really know why but when I run it with the Pycharm debugger it also gives me the error: AttributeError: 'builtin_function_or_method' object has no attribute 'COUNT' for the names_contains function.

  1. as you can see I create a few records in the tables Name and one in the table Triplet. Triplet is linked with Name with a foreign key relationship
  2. [11:27]
    insert_triplet is also supposed to index the triplet so that it is part of a virtual table called TripletIndex which is searchable
  3. [11:28]
    then I run a search and want to print the results
  4. [11:33]
    when I get a search result it should look like this approximately - I want to display the head name and the tail name, they're hyperlinks to the corresponding id_links it should aslo have the id so I can later edit and delete by id
    Image
  5. [11:34]
    hope this makes it easier to understand or visualise
Reply all
Reply to author
Forward
0 new messages