Closed ccoupe closed 7 years ago
ftsearch is broken and buggy. The Shoes manual is considerably bigger, so you may have better result with a bigger text file. I had already moved away from ftsearch in favour of Picky.
it seems Picky needs some sort of struct to index. Do you have that code or do we have to figure it out?
it seems Picky needs some sort of struct to index.
Picky is building an index database to ensure a speedy search lookup. Shoes will have to prebuild this index database for Shoes Manual before each release, to let the end-users enjoy the manual without having to wait (e.g. fontconfig issue). We can write a Rake task for this purpose.
Do you have that code or do we have to figure it out?
I have to code somewhere. Let me get back to you on this one. It's however very easy: I simply replaced the ftsearch API calls with Picky, plus added some parameters to allow Picky to behave the same way Shoes Manual search was before.
it seems Picky needs some sort of struct to index.
Oops. My apologies. I thought you were talking about the database.
The struct is used to build the search database. You can say, for example, each item is composed of a title and a description. Thereafter you can search by titles and/or descriptions.
Shoes will have to prebuild this index database for Shoes Manual before each release, to let the end-users enjoy the manual without having to wait (e.g. fontconfig issue). We can write a Rake task for this purpose.
I fixed the Windows fontconfig a release or two back in Shoes - now it uses Windows APIs to build the Shoes font list instead of the fc-cache/FONTCONFIG_FILE ugliness. - you can even have multiple Shoes installed without fighting over fontconfig. - or getting two paths stuck in the env var. The FONTCONFIG_FILE is no longer used. exe-shoes would not be possible without that fix.
When an author decides to 'publish' his ebook (create a .exe if he's running Windows) we can save the picky index then and include it in the merge of his Shoes and his ebook (app).
Check your emails. I found the code for Picky to replace ftsearch. Should be working right out of the box but haven't tried lately. Enough to get you started anyway. Enjoy.
RE: fontconfig
Very glad to read about it.
When an author decides to 'publish' his ebook (create a .exe if he's running Windows) we can save the picky index then and include it in the merge of his Shoes and his ebook (app).
Agreed.
it seems Picky needs some sort of struct to index.
As a reference, the code I submitted to you through email, there is the structure you are looking for. Additionally, the members of the structure are used as searchable terms category :uri and category :body, id is always implied. Members of the structure not declared to Picky may not be searchable, it may not know how to retrieve it, hence a block is provided to Picky to process its member accordingly.
Document = Struct.new :id, :uri, :body
Picky
# ...
category :uri, :from => lambda { |doc| doc.uri.dup }
category :body, :from => lambda { |doc| doc.body.dup }
#...
Additional references on Picky issue #142 and Picky issue issue #139.
Eventually. Hard coded paths. But it works.
Picky is working instead of ftsearch so I'm closing this issue. There can can be many issues. This one was narrow.
This chunk of code from @BackOrder fails somewhere in ftsearch (as many things do) but we have to start somewhere.