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 10 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="john@company.com",
  to="jane@company.com",
  ...
)

or

shortestPath(
  collection,
  from="john@company.com",
  to="jane@company.com",
  ...
  solr15546fix=true
)

for fixed behaviour with the option of

shortestPath(
  collection,
  from="john@company.com",
  to="jane@company.com",
  ...
  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 dev@solr.apache.org 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PR not updated in 60 days
Projects
None yet
3 participants