You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Daniel Baughman <da...@hostworks.com> on 2011/03/09 18:34:54 UTC

Newb query question

Is there a way to perform string logic on the key field using a subquery or
some other method.

 

IE. If the left 4 characters of the key are ABCD, then include or exclude
those from the search.

 

Here is the "laymans" pseudo code for what I'm wanting to do:

 

*:* AND LEFT(KEY, 4) <> 'abcd'

 

Anyone know that one?


Re: Newb query question

Posted by Erick Erickson <er...@gmail.com>.
How about something like:

for exclusion
+*:* -KEY:abcd*

for inclusion
+*:* +KEY:abcd*

Best
Erick

On Wed, Mar 9, 2011 at 12:34 PM, Daniel Baughman <da...@hostworks.com> wrote:
> Is there a way to perform string logic on the key field using a subquery or
> some other method.
>
>
>
> IE. If the left 4 characters of the key are ABCD, then include or exclude
> those from the search.
>
>
>
> Here is the "laymans" pseudo code for what I'm wanting to do:
>
>
>
> *:* AND LEFT(KEY, 4) <> 'abcd'
>
>
>
> Anyone know that one?
>
>

Re: Newb query question

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hi,

It sounds like if you put those 4 chars in a separate field at index time you 
could apply your logic on that at search time.

Otis
----
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch
Lucene ecosystem search :: http://search-lucene.com/



----- Original Message ----
> From: Daniel Baughman <da...@hostworks.com>
> To: solr-user@lucene.apache.org
> Sent: Wed, March 9, 2011 12:34:54 PM
> Subject: Newb query question
> 
> Is there a way to perform string logic on the key field using a subquery  or
> some other method.
> 
> 
> 
> IE. If the left 4 characters of the key  are ABCD, then include or exclude
> those from the search.
> 
> 
> 
> Here  is the "laymans" pseudo code for what I'm wanting to do:
> 
> 
> 
> *:* AND  LEFT(KEY, 4) <> 'abcd'
> 
> 
> 
> Anyone know that one?
> 
>