[BUG]: Spaces not preserved when using textjoin: or concat:

Discussion related to "Everything" 1.5.
Post Reply
DerekZiemba
Posts: 54
Joined: Thu Sep 27, 2018 4:46 pm

[BUG]: Spaces not preserved when using textjoin: or concat:

Post by DerekZiemba »

Examples:
  • Concat: / Concatenate:
    1. add-column:A A:=[concat:$ext:," File"]

      Expected : png File
      Actual : pngFile
    2. add-column:A A:=[concat:" ",$ext:,"\s \s File"]

      Expected : png \s \s File or png File (something/anything with spaces)
      Actual : png\s\sFile
    3. add-column:A A:=[concat:" ",$ext:," "," "," File"]

      Expected : png File
      Actual : pngFile
    4. add-column:A A:=#[concat:$ext:," File"#]:

      Expected : png File
      Actual : png, File (close, but now has a comma)
    5. add-column:A A:=[concatenate:$ext:,#[[:" File"#]]:]

      Expected : png File
      Actual : pngFile
  • TextJoin:
    1. add-column:A A:=[textjoin:" ",1,$ext:," File"]

      Expected : png File
      Actual : pngFile
    2. add-column:A A:=[textjoin:" ",1,$ext:,"\s \s File"]

      Expected : png \s \s File or png File (something/anything with spaces)
      Actual : png\s\sFile
    3. add-column:A A:=[textjoin:" ",0,$ext:," "," "," File"]

      (notice set ignore-empty to 0 this time, also tried with spaces before & after commas)
      Expected : png File
      Actual : pngFile
    4. add-column:A A:=#[textjoin:" ",0,$ext:," File"#]:

      Expected : idk just throwing stuff at the wall to see if anything works
      Actual : (nothing)
    5. add-column:A A:=#[:textjoin:" ",0,$ext:," File"#]:

      (it treated it mostly as literal text, except $ext: was replaced properly, which gave me the idea to try the next few case)
      Expected : idk, just testing
      Actual : textjoin: ,0,png, File
    6. add-column:A A:=#[:[textjoin:" ",0,$ext:," File"]#]:

      Expected : idk, just testing
      Actual : pngFile (back to original result)
    7. add-column:A A:=#[textjoin:" "#,:0#,:ext:#,:" File"#]:

      ie: #[function:arg1#,:arg2#,:arg3#,:...#]: syntax
      I tried many different variations of this... wrapping/placing/removing $ < > # ] [ : in different spots.
      Expected : idk, just testing
      Actual : png#,: File#]:

Goal:
To exclude files the system doesn't recognize.
Files that are recognized, have Types such as: "Document", "Wave Sound", "C Source File", etc.
Files that are unrecognized typically have a Type of "${extension} File" or "File".
  • So I'm trying to filter them with:
    file: !exact:type:[concat:UPPERCASE($ext:)," File"]

    (textjoin is actually what I want. Neither work though)
  • OR:
    file: !type:TEXTJOIN(" ",0,UPPERCASE($ext:),"File")
    • Using only ColumnForumlas doesn't work which is why I assume I needed to use SearchPreprocessor syntax.
I'm not sure when to use PreprocessorFunctions or ColumnForumlas or in which cases one's more preferable. I've only ever had luck with ColumnFormula syntax though.

The lack of it preserving spacing when joining strings + seemingly other issues, appears to make this goal unattainable.

What Does Work:
  • add-column:A A:=CONCAT(UPPERCASE($ext:)," File")

    But why doesn't it work as documented in SearchPreprocessor viewtopic.php?t=10099 ?
    So it does work for columns, however it DOESNT work for: file: exact:type:CONCAT(UPPERCASE($ext:)," File")
  • add-column:A A:=TEXTJOIN(" ",0,UPPERCASE($ext:),"File")

    But why doesn't it work as documented in SearchPreprocessor viewtopic.php?t=10099 ?
    So it does work for columns, however it DOESNT work for:
    • file: !exact:type:TEXTJOIN(" ",0,UPPERCASE($ext:),"File")
    • file: type:[TEXTJOIN(" ",0,UPPERCASE($ext:),"File")
    • file: !exact:type:#[:TEXTJOIN(" ",0,UPPERCASE($ext:),"File")#]:
Combining things doesn't appear to work. I figured if I could assign the result to ColumnA, maybe I could then pass ColumnA to "Type:".
file+: add-column:A,B A:=TEXTJOIN(" ",0,UPPERCASE($ext:),"File") B:=#<:$A:#>: !type:#<:$A:#>:

ColumnB is assigned to verify syntax.
Screenshot 2025-04-16 151447.png
Screenshot 2025-04-16 151447.png (132.81 KiB) Viewed 1206 times
file+: add-column:A,B A:=TEXTJOIN(" ",0,UPPERCASE($ext:),"File") B:=#<:$A:#>: !type:#<:$A:#>: distinct:Type regex:extension:"^[a-z]+\d?$"

In the screenshot I used the above query in order to get more examples. Curious, why is "distinct:Type" not doing what I expected? It mostly works, but not entirely. Also found
regex:extension:"^[a-z]+\d?$"
works but not
regex:ext:"^[a-z]+\d?$"

NOTE: You may have notice I used "file+:". That's a Bookmark that just adds/removes columns specific to files.
void
Developer
Posts: 19870
Joined: Fri Oct 16, 2009 11:31 pm

Re: [BUG]: Spaces not preserved when using textjoin: or concat:

Post by void »

A:=
uses formulas.

[concat:$ext:," File"]
is expanded before the formula is executed.



A:=[concat:$ext:," File"]

=>
A:=$ext File


Spaces are ignored by formulas.
(I will consider treating them as literal when they are near literal text)



a:=[concat:$ext:,&quot:" file"&quot:]

=>
a:=$ext" file"




The correct syntax should be:
$ext:.." file"
but Everything will concat by default anyways.
Post Reply