Project

General

Profile

Feature #1021

CoCoA Manual: search should ignore multiple spaces

Added by John Abbott over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Manual/documentation
Target version:
Start date:
06 Mar 2017
Due date:
% Done:

100%

Estimated time:
1.88 h
Spent time:

Description

Some CoCoA online manual pages have titles containing spaces.
Searching for such a page with a search string containing too many spaces fails.

Make the search replace multiple spaces by a single space.


Related issues

Related to CoCoA-5 - Support #1054: CoCoAManual: improved search, or improved selection of "see also" pagesNew2017-04-28

History

#1 Updated by John Abbott over 7 years ago

I suggest transforming the search string as follows:
  • replace all TABs (and any other whitespace chars) by plain spaces
  • replace substrings of consecutive spaces by single spaces

I believe spaces at the start and end are already stripped.

#2 Updated by John Abbott about 7 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

There is a fn called CleanupKeyword at around OnlineHelp.C:600.

This is probably what needs to be changed!

#3 Updated by John Abbott about 7 years ago

  • Target version changed from CoCoA-5.?.? to CoCoA-5.2.2
  • % Done changed from 10 to 20

I have written a simple implementation of CleanupKeyword, but it is rather different from the current version.

Roughly speaking, it scans the input from left to right:
  • stop as soon as it sees ; or // or --
  • replace multiple spaces by a single space
  • other chars are simply copied across

Here are some sample inputs: what do we want to happen with these?

?   file   io
?  factor   ; abcdefg
?  factor   -- comment
?  factor   // comment
?    ?   factor   // same as ?? factor
? #illegal char
?  "string" 

#4 Updated by Anna Maria Bigatti about 7 years ago

? file io --> ? file io

? factor ; abcdefg --> don't know, maybe ? factor

? factor -- comment
? factor // comment --> ? factor

? ? factor // same as ?? factor --> I prefer ? factor

? #illegal char --> don't know, maybe I would just ignore the illegal char
? "string" --> ? string (i.e. ignore quotes)

[...]

#5 Updated by John Abbott about 7 years ago

  • Related to Support #1054: CoCoAManual: improved search, or improved selection of "see also" pages added

#6 Updated by John Abbott about 7 years ago

Here are the special chars which I have noticed in the manual page headings (obtained by typing just ?):
  • comma (to separate several names in the title, e.g. BinomialRepr, BinomialReprShift)
  • square brackets (to contain [OBSOLESCENT])
  • digits (e.g. Bool01 and BlockMat2x2)
  • minus sign (_e.g. CoCoA-4 mode)
  • underscore (only in E_ [OBSOLETE]) -- we have both OBSOLETE and OBSOLESCENT??
  • colon (e.g. in Tutorial-01: manual)

However the manual search will also search for substrings in the text of a page, thus the following works:

? <>

I think my current preference is not to do anything "clever" with unusual chars: if the user types in a strange char in a manual search then CoCoA will just respond with a message No matches for "bla bla".

I could easily be convinced that double quotes should be silently ignored in manual searches; so the following queries would all be equivalent:

? factor
? "factor" 
? "f"a"c"t"o"r" 

Comments? Opinions? Ideas?

#7 Updated by Anna Maria Bigatti about 7 years ago

John Abbott wrote:

I think my current preference is not to do anything "clever" with unusual chars: if the user types in a strange char in a manual search then CoCoA will just respond with a message No matches for "bla bla".

I agree

I could easily be convinced that double quotes should be silently ignored in manual searches;

I find the last one a bit funny, but this strategy it the less painful to allow
? "factor"

#8 Updated by John Abbott about 7 years ago

Yes, the last example was deliberately strange; I do not think it matters if such a strange input works...

Maybe I'll implement it, and we can try it...

#9 Updated by Anna Maria Bigatti almost 7 years ago

John Abbott wrote:

Yes, the last example was deliberately strange; I do not think it matters if such a strange input works...

Maybe I'll implement it, and we can try it...

OK

#10 Updated by John Abbott almost 7 years ago

I am still a bit undecided how best to handle double quotes. I see 3 reasonable options:
  1. leave them as they are
  2. remove them completely
  3. regard them as equivalent to spaces

Approach (1) is the easiest to implement; the user just has to learn to use them only when really needed (when???)
Approach (2) is easy to state but might produce unexpected results ("f"a"c"t"o"r" --> factor)
Approach (3) might be fairly natural....? (this implies "f"a"c"t"o"r" --> f a c t o r)

Opinions?

NOTE I have just checked-in the code "as is"; this implies approach (1) for the moment.

#11 Updated by John Abbott almost 7 years ago

  • Status changed from In Progress to Resolved
  • Assignee set to John Abbott
  • % Done changed from 20 to 60

#12 Updated by Anna Maria Bigatti almost 7 years ago

  • Assignee deleted (John Abbott)
  • % Done changed from 60 to 20

John Abbott wrote:

I am still a bit undecided how best to handle double quotes. I see 3 reasonable options:
  1. leave them as they are
  2. remove them completely
  3. regard them as equivalent to spaces

Approach (1) is the easiest to implement; the user just has to learn to use them only when really needed (when???)
Approach (2) is easy to state but might produce unexpected results ("f"a"c"t"o"r" --> factor)
Approach (3) might be fairly natural....? (this implies "f"a"c"t"o"r" --> f a c t o r)

I vote (3)

#13 Updated by John Abbott over 6 years ago

  • Status changed from Resolved to Closed
  • Assignee set to John Abbott
  • % Done changed from 20 to 100
  • Estimated time set to 1.88 h

I have implemented Approach (3).

Should we tell the public that double-quotes are "ignored" when searching in the manual?
(I'm inclined to say nothing... so have not written anything in RelNotes.cpkg5)

Also available in: Atom PDF