Solr/Lucene question

I’ve been looking at COOK-3262, and something I’ve been wondering… What
is the difference between:

hostname:[* TO *] NOT chef_environment:_default

And:

hostname:* NOT chef_environment:_default

?

I’m not really hip to Solr syntax outside of the most obvious stuff.

Also, while I’m discussing this, during the last code review of this,
opinions were somewhat split between having an attribute be an additional
filter after the hostname part of the query and having the attribute be the
entire query. I’ve got a branch that does the latter and it seems to work
fine without running into any quoting/escaping issues. My general feeling
is that that’s a cleaner, more extensible way of approaching things and
most people won’t run into quoting issues… And if they do, they’re likely
familiar enough with Solr/Lucene that quoting the query in JSON isn’t going
to be a hardship for them. More specifically, I tend to think that most
people will just end up doing role/environment based queries which should
be very straightforward. Thoughts before I resubmit the PR?

~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Wed, Jul 10, 2013 at 5:04 PM, Morgan Blackthorne
stormerider@gmail.comwrote:

I've been looking at COOK-3262, and something I've been wondering... What
is the difference between:

hostname:[* TO *] NOT chef_environment:_default

And:

hostname:* NOT chef_environment:_default

?

I'm not really hip to Solr syntax outside of the most obvious stuff.

I'm not sure there is a difference -- at least, in my experimentation, I
couldn't find one. (Also I assume you mean "AND NOT" but that's true for
both situations...)

  • Julian

There was some discussion about that on one of my first contributions and
the consensus was that AND NOT was incorrect; NOT is the correct form.

On Wednesday, July 10, 2013, Julian C. Dunn wrote:

On Wed, Jul 10, 2013 at 5:04 PM, Morgan Blackthorne <stormerider@gmail.com<javascript:_e({}, 'cvml', 'stormerider@gmail.com');>

wrote:

I've been looking at COOK-3262, and something I've been wondering... What
is the difference between:

hostname:[* TO *] NOT chef_environment:_default

And:

hostname:* NOT chef_environment:_default

?

I'm not really hip to Solr syntax outside of the most obvious stuff.

I'm not sure there is a difference -- at least, in my experimentation, I
couldn't find one. (Also I assume you mean "AND NOT" but that's true for
both situations...)

  • Julian

--

~~ StormeRider ~~

"Every world needs its heroes [...] They inspire us to be better than we
are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On why I hate the phrase "that's so lame"... http://bit.ly/Ps3uSS

On Wednesday, July 10, 2013 at 2:04 PM, Morgan Blackthorne wrote:

I've been looking at COOK-3262, and something I've been wondering... What is the difference between:

hostname:[* TO *] NOT chef_environment:_default

And:

hostname:* NOT chef_environment:_default

?

I'm not really hip to Solr syntax outside of the most obvious stuff.
Nowadays, there's not any difference.

Long answer: In the original implementation of Solr search for chef, every key was stored as a separate field in Solr. Among other downsides, you cannot begin the search within a field with a wildcard character. We later rewrote the search implementation (for performance reasons) to store all data in one big field in Solr and added a translation layer on top of it. One of the benefits is that both the key and search query you send to the Chef server are actually just strings in the big Solr field, so a search like "hostname:*" is valid.

--
Daniel DeLeo