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

SOLR-15546: ShortestPathStream to handle ids with colons. #236

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

cpoerschke
Copy link
Contributor

@@ -433,7 +433,7 @@ public JoinRunner(List<String> nodes) {
StringBuffer nodeQuery = new StringBuffer();

for(String node : nodes) {
nodeQuery.append(node).append(" ");
nodeQuery.append('"').append(node).append('"').append(" ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if there are quotes in the id?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good remark

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if there are quotes in the id?

Good question! I'd briefly wondered about the backwards compatibility aspects w.r.t. adding surrounding quotes in the code when the caller already added them as a workaround, and then I had lost track of that.

One difference between the code adding surrounding quotes vs. the caller adding them is that the code also adds them for interim nodes. I've amended the test coverage to explore that further.

Also adjusted the code change to not add surrounding quotes if there are some already but obviously quotes could also be in the middle of the id, say Alice ("Ally") or Robert ("Bob") both of which also contain parentheses as it happens, hmm.

@madrob
Copy link
Contributor

madrob commented Jul 29, 2021

I didn’t even consider the “quoted” case, I was thinking of text with a quote character in the middle. But I’m glad that we are thinking about that one too!

@cpoerschke
Copy link
Contributor Author

... text with a quote character in the middle. ...

I would speculate that somehow encoding the id might be one approach? The text could contain quotes in the middle or apostrophe or colon or space or other stuff too.

@cpoerschke
Copy link
Contributor Author

Hmm, have tried but not yet found a way to support quotes in the middle.

And if there is a space in the text then the code adding surrounding quotes changes the results, so with that behaviour change in mind perhaps any fix would be for 9x only and then no need to consider the scenario of the caller having added surrounding quotes since backwards compatibility is not retained anyhow?

Either way, I've amended the test coverage to include space and single and double quotes.

@madrob
Copy link
Contributor

madrob commented Aug 26, 2021

perhaps any fix would be for 9x only and then no need to consider the scenario of the caller having added surrounding quotes since backwards compatibility is not retained anyhow

I think we still want to back port a fix for colons at least to 8x? Maybe there are parts that stay 9x only, but I think this is probably something important to have in our release line

@cpoerschke
Copy link
Contributor Author

perhaps any fix would be for 9x only and then no need to consider the scenario of the caller having added surrounding quotes since backwards compatibility is not retained anyhow

I think we still want to back port a fix for colons at least to 8x? Maybe there are parts that stay 9x only, but I think this is probably something important to have in our release line

One way for a backwards compatible or "backwards compatible friendly" change for the 8x release line could be via an optional flag:

shortestPath(
  collection,
  from="[email protected]",
  to="[email protected]",
  ...
)

or

shortestPath(
  collection,
  from="[email protected]",
  to="[email protected]",
  ...
  solr15546fix=true
)

for fixed behaviour with the option of

shortestPath(
  collection,
  from="[email protected]",
  to="[email protected]",
  ...
  solr15546fix=false
)

for backwards compatible behaviour. So solr15546fix as an opt-out, solr15546fix would have to be some other name of course, and depending on name and whether or not it would be in 9.x also it could also be opt-in rather than opt-out though for this type of fix opt-out seems best.

Copy link

This PR had no visible activity in the past 60 days, labeling it as stale. Any new activity will remove the stale label. To attract more reviewers, please tag someone or notify the [email protected] mailing list. Thank you for your contribution!

@github-actions github-actions bot added the stale PR not updated in 60 days label Feb 25, 2024
Copy link

github-actions bot commented Oct 6, 2024

This PR is now closed due to 60 days of inactivity after being marked as stale. Re-opening this PR is still possible, in which case it will be marked as active again.

@github-actions github-actions bot added the closed-stale Closed after being stale for 60 days label Oct 6, 2024
@github-actions github-actions bot closed this Oct 6, 2024
@epugh
Copy link
Contributor

epugh commented Oct 6, 2024

@cpoerschke if we assume this code would only go on main, does that make it easier to merge this code? Seems like a great fix.

@epugh epugh reopened this Oct 6, 2024
@github-actions github-actions bot added client:solrj tests and removed closed-stale Closed after being stale for 60 days stale PR not updated in 60 days labels Oct 6, 2024
Copy link

github-actions bot commented Dec 9, 2024

This PR has had no activity for 60 days and is now labeled as stale. Any new activity will remove the stale label. To attract more reviewers, please tag people who might be familiar with the code area and/or notify the [email protected] mailing list. To exempt this PR from being marked as stale, make it a draft PR or add the label "exempt-stale". If left unattended, this PR will be closed after another 60 days of inactivity. Thank you for your contribution!

@github-actions github-actions bot added the stale PR not updated in 60 days label Dec 9, 2024
@epugh
Copy link
Contributor

epugh commented Dec 9, 2024

I'd love to see this get into 10 without the legacyJoin stuff, since that seems hard to explain? Thoughts? If you don't have bandwidth/energy on this one, let me know and I can take it on..

@github-actions github-actions bot removed the stale PR not updated in 60 days label Dec 10, 2024
@cpoerschke
Copy link
Contributor Author

I'd love to see this get into 10 without the legacyJoin stuff, since that seems hard to explain? Thoughts? If you don't have bandwidth/energy on this one, let me know and I can take it on..

Sure, please feel free to take this over etc. -- thanks!

@epugh epugh self-assigned this Jan 6, 2025
@epugh
Copy link
Contributor

epugh commented Feb 15, 2025

I've tried to take a stab at this, and honestly I think I made this one worse. I think this is going to be one of those "someday if I need this, or a smarter person comes along with a fix, let's look at it again" issue.. Thoughts on adding a warning to the docs to the effect the id's can't have colons instead?

@epugh epugh removed their assignment Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants