org-ql icon indicating copy to clipboard operation
org-ql copied to clipboard

`rifle` predicate anchors tokens to beginning-of-word

Open Tokubara opened this issue 2 years ago • 2 comments

For example, I cannot search this entry with "rd".

***** word
word

image But I can search this entry with "word". image

I haven't find the description of this behavior in the documentation.

Tokubara avatar Jun 16 '23 13:06 Tokubara

The issue is that tokens passed to the rifle/smart predicate are anchored to the beginning of a word:

https://github.com/alphapapa/org-ql/blob/eb5377320fcfd38354d6e9e3e655969ae3c0e052/org-ql.el#L1642

So they can match parts of a word, but only at the beginning of one.

I don't recall why I added the bow there. It was probably for a reason, but maybe it's not necessary.

If you like, we could make a branch without that anchoring and you could test it for a while and let me know if you experience any problems. Then if it seems to work well, it could be changed in the next version.

What do you think? Thanks.

alphapapa avatar Jun 16 '23 14:06 alphapapa

I think it would be great if we could modify this behavior because for non-English content, like Chinese, it doesn't have the natural word segmentation like English, which can cause non-English queries to miss results. My current level of elisp is naive, and there are many syntaxes that I don't understand. I will try to understand the code in the next few days to see how to modify it. Thank you for your reply!

Tokubara avatar Jun 16 '23 14:06 Tokubara