Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rifle predicate anchors tokens to beginning-of-word #355

Open
Tokubara opened this issue Jun 16, 2023 · 2 comments
Open

rifle predicate anchors tokens to beginning-of-word #355

Tokubara opened this issue Jun 16, 2023 · 2 comments

Comments

@Tokubara
Copy link

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.

@alphapapa
Copy link
Owner

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

org-ql/org-ql.el

Line 1642 in eb53773

(list :regexp (rx-to-string `(seq bow (or ,@(mapcar (lambda (s) `(regexp ,s)) regexps))))

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 alphapapa self-assigned this Jun 16, 2023
@Tokubara
Copy link
Author

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!

@alphapapa alphapapa added this to the Future milestone Dec 16, 2023
@alphapapa alphapapa changed the title "rifle" predicate can not find part of a word rifle predicate anchors tokens to beginning-of-word Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants