12462: Treat "/" and "-" as word chars, too.
authorTom Clegg <tclegg@veritasgenetics.com>
Tue, 31 Oct 2017 19:31:33 +0000 (15:31 -0400)
committerTom Clegg <tclegg@veritasgenetics.com>
Tue, 31 Oct 2017 19:31:33 +0000 (15:31 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

apps/workbench/app/assets/javascripts/to_tsquery.js

index 34ccb6c2774d26fe7e85e701a0672e6df5ebacf3..f2e34d9e08d8f790aa42462977ff5163a18732d3 100644 (file)
 // Examples:
 //
 // "foo"     => "foo:*"
-// "foo/bar" => "foo:*&bar:*"
+// "foo_bar" => "foo:*&bar:*"
 // "foo.bar" => "foo.bar:*"    // "." is a word char in FT queries
+// "foo/b-r" => "foo/b-r:*"    // "/" and "-", too
 // "foo|bar" => "foo:*&bar:*"
 // " oo|ba " => "oo:*&ba:*"
-// "// "     => null
+// "__ "     => null
 // ""        => null
 // null      => null
 window.to_tsquery = function(q) {
-    q = (q || '').replace(/[^\w\.]+/g, ' ').trim().replace(/ /g, ':*&')
+    q = (q || '').replace(/[^-\w\.\/]+/g, ' ').trim().replace(/ /g, ':*&')
     if (q == '')
         return null
     return q + ':*'