chef-zero icon indicating copy to clipboard operation
chef-zero copied to clipboard

bug in chef zero search query involving multiple attributes and attribute presence check

Open nicfarges opened this issue 10 years ago • 5 comments

Hi,

there seem to be some inconsistency between chef server and chef zero on queries involving multiple nested attributes and attribute presence check...

on enterprise chef server:

  • knife search node "languages_ruby:*" -i -> return all nodes that have "ruby" attribute under "languages"

on chef zero (included in chef client 11.12.8, as test-kitchen provisioner):

  • knife search node "languages_ruby:*" -i -z -> return 0 node
  • however, this following query works on chef-zero: knife search node "languages_ruby_version:*" -i -z -> return 1 node

It seems does this bug apply only in node attributes (opposite to "leaf" attributes) in chef zero ? or maybe I miss something on query semantic ...

nicolas farges GE Capital

nicfarges avatar Jul 21 '14 16:07 nicfarges

I am encoutering the same issue, is this issue still valid, or did you find out a way around?

kri5 avatar Jan 26 '15 16:01 kri5

After diving into the code, it seems that search uses a matches_doc? method here https://github.com/chef/chef-zero/blob/master/lib/chef_zero/endpoints/search_endpoint.rb#L117

Which one comes from the result of a SolrParser.parse, and it seems to return a BinaryOperator, and when you look at the way it handles the attributes lookup here https://github.com/chef/chef-zero/blob/master/lib/chef_zero/solr/query/binary_operator.rb#L29 , you notice that there is no job looking up for nested attribute form, it just look at the json at the corresponding key.

I'm quite new to chef-zero, does anyone has an idea on how it should be handled?

kri5 avatar Jan 26 '15 16:01 kri5

Any ideas?

kri5 avatar Apr 09 '15 14:04 kri5

I'm running into the same issue. Are there any plans to implement a fix, or does anyone have a good workaround?

TeddyRux avatar Oct 13 '16 18:10 TeddyRux

After 5 years, this is still a bug. Ist there any work going on?

tbe avatar Feb 28 '19 15:02 tbe