Home » Devtech review » LangsNTechs » SOLR NOT condition trick

SOLR NOT condition trick

Apache SOLR, an “open source enterprise search server”, demonstrates indecently inconsistent and illogical handling of NOT conditions in it’s queries (like “x:1 AND NOT x:2” producing 0 results, yet “x:1 AND (NOT x:2)” producing correct results etc).

We couldn’t play with braces because our conditions are autogenerated, so we needed a generic solution for this.

Fortunately, workaround has been found for this with simple Googling. Instead of querying for “… AND/OR (NOT [condition])” just use “… AND/OR (*:* NOT [condition])” or “… AND/OR (*:* AND NOT [condition])“.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s