shoes / shoes3

a tiny graphical app kit for ruby
http://walkabout.mvmanila.com
Other
180 stars 19 forks source link

Picky engine doubles some search results #339

Open dredknight opened 7 years ago

dredknight commented 7 years ago

@BackOrder , @ccoupe I think I bumped into something. Any of the three examples below is executed by Shoes.

Shoes.app( width: 400, height: 100 ) do
  line 10,40,350,40, stroke: green, strokewidth: 3
  line 10,20,350,20, stroke: green, strokewidth: 3
end
Shoes.app( width: 400, height: 100 ) do
  line 10,40,350,40, dash: :onedot, stroke: green, strokewidth: 3
  line 10,20,350,20, dash: nodot, stroke: green, strokewidth: 3
end
Shoes.app( width: 400, height: 100 ) do
  line 10,40,350,40, dash: :onedot, stroke: green, strokewidth: 3
  line 10,20,350,20, stroke: green, strokewidth: 3
end

Try to put the last one as a code in the manual.

{{{ Shoes.app( width: 400, height: 100 ) do line 10,40,350,40, dash: :onedot, stroke: green, strokewidth: 3 line 10,20,350,20, stroke: green, strokewidth: 3 end }}}

Launch the manual and you will get this error. The other two examples work fine.

Error in <unknown> line 0 | 2017-03-11 21:35:35 +0200
no implicit conversion from nil to integer
C:/Program Files (x86)/Shoes/lib/ruby/2.2.0/ftsearch/suffix_array_writer.rb:79:in `[]'
C:/Program Files (x86)/Shoes/lib/ruby/2.2.0/ftsearch/suffix_array_writer.rb:79:in `block in dump_inline_suffixes'
C:/Program Files (x86)/Shoes/lib/ruby/2.2.0/ftsearch/suffix_array_writer.rb:78:in `step'
C:/Program Files (x86)/Shoes/lib/ruby/2.2.0/ftsearch/suffix_array_writer.rb:78:in `dump_inline_suffixes'
C:/Program Files (x86)/Shoes/lib/ruby/2.2.0/ftsearch/suffix_array_writer.rb:69:in `dump_suffixes'
C:/Program Files (x86)/Shoes/lib/ruby/2.2.0/ftsearch/suffix_array_writer.rb:57:in `finish!'
C:/Program Files (x86)/Shoes/lib/ruby/2.2.0/ftsearch/fragment_writer.rb:105:in `finish!'
C:/Program Files (x86)/Shoes/lib/shoes/search.rb:20:in `finish!'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:257:in `load_docs'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:453:in `block in make_help_page'
eval:1:in `instance_eval'
eval:1:in `block in <main>'
-e:1:in `call'
IanTrudel commented 7 years ago

Which version of Shoes are you using? The current beta 3.3.3 no longer relies on ftsearch. The sample you mentioned is working here.

http://walkabout.mvmanila.com/public/shoes/

dredknight commented 7 years ago

Thanks. I was using the current prod 3.3.2. With 3.3.3 it works fine but when I do a search for some reason it duplicates the results. Try for example to search for "align". You will see 5-6 results where the first and the last are the same.

IanTrudel commented 7 years ago

Shoes now use Picky as a search engine. The current behaviour is trying to mimic Shoes former ftsearch as close as possible. It may need some fine tuning. However, I am not getting the extra results you are talking about.

image

ccoupe commented 7 years ago

I get 5 for align but I'm not running on the latest manual. Not major issue for me but it needs to stay open until it's fixed or agreed to be a non-issue.

IanTrudel commented 7 years ago

@dredknight thanks for changing the title. Would you mind look at all the result one-by-one? I suspect there are the word align multiple times in the same section, thus repeating. It would be kinda OK but could be improved.

dredknight commented 7 years ago

@BackOrder nice idea! I opened "align" page and the word is actually referred numerous times (4 or 5). I tried the same with dash - it has the word in the header and twice in the text. Unfortunately after removing the word from text nothing changed. Still the answers are double.

Could you test something on your side (v3.3.3) in the search type "dash". In the default manual vesion dash is still not present so no results should pop. However the search result says different: image

As you may see there is no "dash" word in the result in any of the text.

image

P.S.

Also in some of the "align" results there was no "align" word either. For example one of the results was -> rise.

image

I can further dive into this but I need a direction where to start from. For example where is the code to troublehoot for picky? and how to follow up on whats happening when searching?

dredknight commented 7 years ago

I will try to dig something on my own tomorrow :D.

IanTrudel commented 7 years ago

Open Windows Explorer, copy %LOCALAPPDATA%\Shoes and remove index directory. Reload Shoes Manual and Picky will reindex. Should be fine.

dredknight commented 7 years ago

Thanks!! I found the issue for duplication!

Article gets duplicated when the searched word can be found both in header and body at least once.

dredknight commented 7 years ago

here is the following test:

  1. Dash - multiple times only in body - Search gives 1 result.
  2. Dash - once in header once (or more) in body = 2 search results.
  3. Dash - once or more times in header only = 2 search results.

hm... it seems this formula is not the same for all elements. For example "flow" can be found in its header and body text but the engine gives only 1 Flow result.

Some tests with "align" text provide the same results as Dash. When "align" title is changed to something different, duplication stops.