-
Notifications
You must be signed in to change notification settings - Fork 19
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
Rework strict path matching #24
Comments
Based on all your examples, I think that is exactly what I want. Thank you for giving this feature request so much thought and attention. I look forward to using it once it's implemented. I already have a use in mind, in another open source project. I'll show you when integration is done. |
Thanks for reviewing! I have set the deadline for version 0.8.0 for April 1, but I think I can get this feature done well before then. I'll share here once I have it working. I already think I know the changes needed and it shouldn't be too complex actually. |
Now the strict path matching no longer requires contiguous patch segments to match, and a segment before the first / will also be used for strict path matching. See #24
I think I have everything working! See the The behavior is now
In other words, exactly as described above. For @ratfactor's idea to leave the right part of the token "fuzzy", I didn't implement this for a few reasons.
I'm still open to this "fuzzy" right path if we can find a way to do it. But I'm not sure if it's possible. And I think adding a space is a good enough solution. |
I did my best to break it (I even enlisted my wife, who is really good at breaking software). Here's my attempt at an increasingly pathological test:
👍 I agree that zf's existing support for separate fuzzy tokens does what I need. There's no actual need for a "right/left" matching like I was picturing. This already does what I would expect. As long as all portions of a path are true, the match is good regardless of the order I enter them. The results of this weird search are fine:
And if I want to enforce the right/left order of the path portions, I just need to keep the path together. With a space:
No space:
The matching of the last part, "brown," is still fuzzy, but the order is enforced. That's all I need! A cool bonus feature that is also possibly unrelated from this path matching specifically, but something I noticed while testing: A search token consisting of some number of slashes is a way to request a minimum path depth. Example: The three slashes here filtered out any paths that weren't at least three directories deep:
I thought that was neat. In all, it works great and I wasn't able to break it. As before, I'm really excited about this feature and I've already switched to the new version for personal use. 🎉 |
This is good! But, and I apologize 😅, it's not quite where I'd like it to be. Given that this path exists:
It doesn't match with this search string:
My thinking is: I know I have a model named baz, so I type |
@Pistos this really should work. I haven't looked at the code yet, but I think I know where this bug is coming from. I'll try to fix it soon |
How did I not run into this? I am so bad at testing software. 🤣 |
@natecraddock Yes, I had a feeling this is a bug rather than intentional design. As a clue, my first guess would be that there's an edge case having to do with a full segment match ( Some more data:
which is highlighting the |
I was right, it was a simple bug to fix! I have fixed it (and pushed to the branch) and now Something I noticed that is related, but a separate issue I'll address later
In this case I think we should expect |
@ratfactor thanks for your thorough testing. I missed this bug myself, so no worries! |
I'll test some more later, but it seems all good so far! Good work. 👍 I have some more feature requests, but I'll make them in separate github issues. |
Issue to track this: #26
I'll go ahead and merge the brach, but I'll leave the issue open for the next couple days |
I added a bunch of tests inspired by the test cases in this issue. It should (hopefully) prevent any regressions in the future. |
Strict path matching was implemented from a request (#11) and I misunderstood the initial request.
As implemented in version 0.7.0 I do think it is currently useful. But there is room for improvement as suggested in later replies in that issue. Current implementation: when a
/
is found the path matching is made strict to the right and requires contiguous paths in the query.There are two good points raised in the issue
I've thought about this for a while and I believe I have a good solution
Solution
/
anywhere.Here are some examples, all using our lovely test strings
Example 1
Example 2
Example 3
With those examples in mind, I think this covers all the possible use cases, and makes things quite useful!
To recap: A query token containing any
/
will be used for strict path matching. The path segments are not required to be contiguous.Currently a query of
mod/
would match bothmo/d/
and/mod/
, but with these changes only/mod/
would be selected.Open questions
I like this idea, but zf already natively supports this fuzziness by inserting a space and adding a new query token. I'm not against adding this, but I think adding a space keeps things more consistent.
The text was updated successfully, but these errors were encountered: