lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <>
Subject Re: Code style
Date Thu, 17 May 2007 18:53:08 GMT

----- Original Message ----

From: Yonik Seeley <>


Sent: Thursday, May 17, 2007 2:05:41 PM

Subject: Re: Code style

On 5/17/07, Otis Gospodnetic <> wrote:

> Should Solr be following the Lucene code formatting/style?  Lucene follows Sun's recommendation
except for the 2-space indent, I believe.

Well, that's the general guidelines... there is a ton of lucene code

that doesn't follow that though.  One "violation" repeated everywhere


if (foo)


Those don't bother me personally, I'm just pointing it out.

OG: yes, that's one of those things my brain must have learned to read easily either way.
 What's missing here?  Curly braces?

> I'm asking because Solr is full of variable and method names that look like abbrevs ;)

> - e.g. getDocListC - "C"?

Heh... I never realized abbreviations were off-limits.

In this particular case, I needed to refactor getDocList into a

caching version and a non caching version (C) and (NC).

OG: Si, I realized that as I read the core more, but it wasn't obvious to me immediately.
 How quickly things become obvious is important, I think.

>, and on top of that the code is rather dense,without,many,spaces, so

it's hard to read, at least for me.

Spaces between lines, or spaces in a single line?

OG: Heh, good question.  Again, spaces or not between lines are easy for me, it's the lack
of spaces in a single line that make things hard to read-kind of like"things should be made
as simple as possible, but not any simpler."-A.Einstein would be hard to read.  Mental token
parsing - WhiteSpaceBrainTokenizer, I guess.

I tend to compress code where the logic is easy to understand...

sometimes spreading simple things out make it harder to see everything

in context.

OG: I agree.  This made me learn to appreciate vertically tight code sometimes.

> How do the rest of you feel?  I volunteer to tidy up the code, if others agree with following
Lucene's formating.  I believe Nutch and Hadoop already follow it.

Solr already has a policy that is the same as Lucene.

I'm fine with cleanups... just try to avoid breaking patches in JIRA.

OG: Right.  Right to what Hoss said in his reply, too.
OG: Luckily, man patch shows  "-l  or  --ignore-whitespace", which might help.


View raw message