Bug #1245
closedAPI bug with search a dot in front of domain when pulling a host list returns the full hostlist of all hosts rather than matching the domain string
Description
The following query works and returns list of hosts in domain.com:
https://foreman.domain.com/hosts?search=domain.com"
but the slightly modified query below return a list of all hosts in the system (just a leading dot):
https://foreman.domain.com/hosts?search=.domain.com"
Updated by Ohad Levy about 13 years ago
- Category changed from API to Search
- Status changed from New to Feedback
Brian Gupta wrote:
The following query works and returns list of hosts in domain.com:
https://foreman.domain.com/hosts?search=domain.com"but the slightly modified query below return a list of all hosts in the system (just a leading dot):
https://foreman.domain.com/hosts?search=.domain.com"
shouldnt it be search="domain = domain.com"?
there was a fix for leading dot handling here https://github.com/wvanbergen/scoped_search/commit/cef7f39fc49666de80c0a64f674f02ff2e9e36c4, not sure with which version are you using
Updated by Brian Gupta about 13 years ago
Upgraded tonight and the issue is still there.
Updated by Ohad Levy about 13 years ago
- Target version deleted (
0.4)
not sure that I follow, but i can you confirm the search syntax? (e.g. your original query might be wrong).
Updated by Brian Gupta about 13 years ago
A little background: Since the search API isn't super well documented, while working on Foremancli, I just used trial and error and found that host/search?domain.com does return a list of hosts in domain.com. Don't know if this is a bug, but from a foremancli point of view being able to type the following is a win:
foremancli --host domain.com
How does the API handle non-paramaterized query strings that don't have an equals sign?
Thanks,
Brian
Updated by Brian Gupta about 13 years ago
Some more further notes: From my observation, at least for hosts, it appears to be a simple pattern match (with some caveats like the leading dot issue) against FQDN. Not sure what it is supposed to be doing. -Brian
Updated by Ohad Levy about 13 years ago
it does a full text search on all fields which are enabled for full text search.... :(