Skip to content

Added method to get a nodes localname #130

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

Merged
merged 1 commit into from
Oct 24, 2014
Merged

Added method to get a nodes localname #130

merged 1 commit into from
Oct 24, 2014

Conversation

dantleech
Copy link
Member

Added method to retrieve the localname for a node from a given path.

@dbu
Copy link
Member

dbu commented Oct 6, 2014

looks ok. what is the use case? i am wondering a bit if we should not expect a node name instead of a path... or we could say it can be either and first check if there is a / in the parameter and if not treat the whole param as a node name.

@dantleech
Copy link
Member Author

the use case may or not be a valid one, in jackalope-fs I want to index the localname - but as I already index the path I'm not sure thats necessary, but I am still learning what is and is not possible with Zend Lucene.

@dbu
Copy link
Member

dbu commented Oct 6, 2014

for jackalope, the node name should usually be including the namespace i guess. but i think if we can support both path and just a full name where we only have to remove the namespace, i am +1 on having this. might be we actually do such splits in jackalope for some reason already.

@dbu
Copy link
Member

dbu commented Oct 9, 2014

do you think you manage to support both path and just a name in one method?

@lsmith77
Copy link
Member

ping .. guess it would be good to resolve this for 1.2.0 stable

@dbu
Copy link
Member

dbu commented Oct 23, 2014

what i mean by my comment: could we make this method work with both absolute paths and full names as parameter, to return the local name regardless of what was the argument? we could maybe just strrpos from the end of the string for either : or / whichever is first, and the whole string if none, and take the last segment. then we have no validation if this is a valid name / path but would handle a lot without much effort.

@dantleech
Copy link
Member Author

@dbu well accepting a node name would make the behavior different from getNodeName which only accepts absolute paths.

return array(
array('/parent/child', 'child'),
array('/parent/ns:child', 'child'),
array('/parent/ns:child:foo', 'child:foo'),
Copy link
Member

Choose a reason for hiding this comment

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

this is an invalid name. i would not have a test for this situation. (if anything, this should lead to an exception)

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed.

@dbu
Copy link
Member

dbu commented Oct 23, 2014

@dantleech okay. if the local name method makes sense for you as it is, lets keep it that way then.

i added a new comment for the test with an invalid node name.

@lsmith77
Copy link
Member

so good to merge so that we can tag a stable release?

@dantleech
Copy link
Member Author

Have removed the invalid test - not sure it should be the responsiblity of that helper method to validate the node name, in anycase getNodeName does not.

dbu added a commit that referenced this pull request Oct 24, 2014
Added method to get a nodes localname
@dbu dbu merged commit cecd974 into master Oct 24, 2014
@dbu dbu deleted the localnodename branch October 24, 2014 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants