I wonder why we can't perform the same REGEXP pattern on file (compared to name/comment):
SELECT
id
from images i
WHERE (CONVERT(file, CHAR) LIKE '%eau%' OR name REGEXP '[[:<:]]eau[[:>:]]')
;
Here we perform an exact match on name (perfect) but not on file :-/ If the user has filenames which describe the photo, it becomes impossible to perform an exact match.
I wonder why we can't perform the same REGEXP pattern on file (compared to name/comment):
```
SELECT
id
from images i
WHERE (CONVERT(file, CHAR) LIKE '%eau%' OR name REGEXP '[[:<:]]eau[[:>:]]')
;
```
Here we perform an exact match on name (perfect) but not on file :-/ If the user has filenames which describe the photo, it becomes impossible to perform an exact match.
<!-- github-sync-id:135358595 -->
My initial thought was that name is plain natural language while file does
not have spaces... But we can change that. Should test if - and _ are
considered word boundaries by MySQL regex
On Feb 22, 2016 10:12, "Pierrick Le Gall" notifications@github.com wrote:
I wonder why we can't perform the same REGEXP pattern on file (compared to
name/comment):
SELECT
id
from images i
WHERE (CONVERT(file, CHAR) LIKE '%eau%' OR name REGEXP ':<:eau:>:')
;
Here we perform an exact match on name (perfect) but not on file :-/ If
the user has filenames which describe the photo, it becomes impossible to
perform an exact match.
My initial thought was that name is plain natural language while file does
not have spaces... But we can change that. Should test if - and _ are
considered word boundaries by MySQL regex
On Feb 22, 2016 10:12, "Pierrick Le Gall" notifications@github.com wrote:
> I wonder why we can't perform the same REGEXP pattern on file (compared to
> name/comment):
>
> SELECT
> id
> from images i
> WHERE (CONVERT(file, CHAR) LIKE '%eau%' OR name REGEXP '[[:<:]]eau[[:>:]]')
> ;
>
> Here we perform an exact match on name (perfect) but not on file :-/ If
> the user has filenames which describe the photo, it becomes impossible to
> perform an exact match.
>
> —
> Reply to this email directly or view it on GitHub
> https://github.com/Piwigo/Piwigo/issues/422.
<!-- github-comment-id:187085950 -->
Actually, file names have no space only when added files with FTP+sync. Many many file names have spaces and "any" char when added with web API.
Actually, file names have no space only when added files with FTP+sync. Many many file names have spaces and "any" char when added with web API.
<!-- github-comment-id:187087657 -->
and I don't understand why the help says you have to do {"word"} for an exact match because {word} already works fine. Actually, if you "don't" want to perform an exact match you have to search {*word*}.
and I don't understand why the help says you have to do {"word"} for an exact match because {word} already works fine. Actually, if you "don't" want to perform an exact match you have to search `{*word*}`.
<!-- github-comment-id:187106768 -->
@plegall, I don't get your last comment. Are you referring to quick search help ?
Use quotes to search for an exact word or phrase. ""george washington""
@plegall, I don't get your last comment. Are you referring to quick search help ?
> Use quotes to search for an exact word or phrase. ""george washington""
<!-- github-comment-id:187116443 -->
Yes, I'm referring to quick search help. If I search {word} (without taking file name into account), Piwigo won't find "wording" or "sword". If I want to get those results I have to search {*word*} (and I think it's a good default behavior, even if it's not the behavior of advanced search). This is why I wonder why there is an "exact match" syntax. I guess it's only for a "phrase" (several words) and not for a single word.
Yes, I'm referring to quick search help. If I search {word} (without taking file name into account), Piwigo won't find "wording" or "sword". If I want to get those results I have to search `{*word*}` (and I think it's a good default behavior, even if it's not the behavior of advanced search). This is why I wonder why there is an "exact match" syntax. I guess it's only for a "phrase" (several words) and not for a single word.
<!-- github-comment-id:187149091 -->
Exact match is primarily for a phrase but also to avoid looking for inflections of a single word (inflections work only in english/french). If your language is french, searches for eau should also match eaux unless eau is quoted. In english singular/plural forms are recognized and also -ing -er (eg. search for runner will also match running or runners)
Exact match is primarily for a phrase but also to avoid looking for inflections of a single word (inflections work only in english/french). If your language is french, searches for **eau** should also match **eaux** unless eau is quoted. In english singular/plural forms are recognized and also -ing -er (eg. search for **runner** will also match **running** or **runners**)
<!-- github-comment-id:187161825 -->
OK, I had understood that when debugging the SQL query, but I don't think it's really "expected". Anyway, I think the current algorithm is fine (excepted for file name) and maybe we should just say that "exact match with surrounding quotes" is for phrases.
OK, I had understood that when debugging the SQL query, but I don't think it's really "expected". Anyway, I think the current algorithm is fine (excepted for file name) and maybe we should just say that "exact match with surrounding quotes" is for phrases.
<!-- github-comment-id:187171301 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
I wonder why we can't perform the same REGEXP pattern on file (compared to name/comment):
Here we perform an exact match on name (perfect) but not on file :-/ If the user has filenames which describe the photo, it becomes impossible to perform an exact match.
My initial thought was that name is plain natural language while file does
not have spaces... But we can change that. Should test if - and _ are
considered word boundaries by MySQL regex
On Feb 22, 2016 10:12, "Pierrick Le Gall" notifications@github.com wrote:
Actually, file names have no space only when added files with FTP+sync. Many many file names have spaces and "any" char when added with web API.
I'll try to find a regexp that works in all cases probably something like:
([[:<:]]|_)eau([[:>:]]|_)and I don't understand why the help says you have to do {"word"} for an exact match because {word} already works fine. Actually, if you "don't" want to perform an exact match you have to search
{*word*}.@plegall, I don't get your last comment. Are you referring to quick search help ?
also note that word will match words. while "word" will not match words.
Yes, I'm referring to quick search help. If I search {word} (without taking file name into account), Piwigo won't find "wording" or "sword". If I want to get those results I have to search
{*word*}(and I think it's a good default behavior, even if it's not the behavior of advanced search). This is why I wonder why there is an "exact match" syntax. I guess it's only for a "phrase" (several words) and not for a single word.Exact match is primarily for a phrase but also to avoid looking for inflections of a single word (inflections work only in english/french). If your language is french, searches for eau should also match eaux unless eau is quoted. In english singular/plural forms are recognized and also -ing -er (eg. search for runner will also match running or runners)
OK, I had understood that when debugging the SQL query, but I don't think it's really "expected". Anyway, I think the current algorithm is fine (excepted for file name) and maybe we should just say that "exact match with surrounding quotes" is for phrases.