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

Add an option to make fixed searches #80

Merged
merged 1 commit into from
Feb 13, 2020
Merged

Add an option to make fixed searches #80

merged 1 commit into from
Feb 13, 2020

Conversation

romainFr
Copy link
Collaborator

neuprint_search used to only take in regular expressions, which can be a bit cumbersome when querying names with brackets and other special characters.
This PR adds a fixed option to neuprint_search, which when TRUE, makes a literal search (like it's now in neuprint explorer), so that:

neuprint_search("PEN_a(PEN1)",field="type",fixed=TRUE)

returns what you would expect, when

neuprint_search("PEN_a(PEN1)",field="type",fixed=FALSE)

returns NULL as it's expecting the brackets to be escaped.

This uses (like neuprint explorer), CONTAINS instead of =~ in the query

@romainFr
Copy link
Collaborator Author

The default is such as existing code isn't altered (meaning it's using a regex)

@romainFr
Copy link
Collaborator Author

I'll merge as it works and doesn't affect the default behavior.

@romainFr romainFr merged commit 1cf61ca into master Feb 13, 2020
@jefferis
Copy link
Contributor

Thanks @romainFr! Two quick comments.

  1. could you just clarify whether this requires a match to the whole name/type or if a partial match is sufficient? regexes must currently match the whole name/type
  2. would be great to include a test exercising this.

@romainFr
Copy link
Collaborator Author

Thanks!

  1. Yes, partial matches work. I added a sentence in the docstring
  2. Just pushed that

@jefferis
Copy link
Contributor

jefferis commented Feb 13, 2020 via email

jefferis added a commit that referenced this pull request Feb 14, 2020
* wrapping up #80
@jefferis
Copy link
Contributor

(just a note that the travis error was just a failure to roxygenise)

@jefferis
Copy link
Contributor

(just a note that fixed=T does not handle exact matches where the whole field matches (only partial matches). I am addressing this.

@jefferis jefferis deleted the newSearch branch February 15, 2020 19:57
jefferis added a commit that referenced this pull request Feb 15, 2020
* implies that the search must match full type
* tests
* builds on #80
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.

2 participants