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 Mike Hugo <mi...@piragua.com> on 2013/05/21 05:42:14 UTC

Expanding sets of words

Is there a way to query for combinations of two sets of words?  For
example, if I had

(java or groovy or scala)
(programming or coding or development)

Is there a query parser that, at query time, would expand that into
combinations like

java programming
groovy programming
scala programming
java coding
java development
....
etc etc etc

Thanks!

Mike

Re: Expanding sets of words

Posted by Mike Hugo <mi...@piragua.com>.
Fantastic!  Thanks for following up - this is great.

Mike



On Tue, May 21, 2013 at 11:17 PM, Jack Krupansky <ja...@basetechnology.com>wrote:

> Ah... and the answer is:
>
> curl "http://localhost:8983/solr/**select/?q=(assembly+W+**
> language+OR+scala)+W+**programming\<http://localhost:8983/solr/select/?q=(assembly+W+language+OR+scala)+W+programming%5C>
> &df=features&defType=surround&**indent=true"
>
> IOW, any quoted phrase like "a b c d" can be written in surround as a W b
> W c W d.
>
> Presto!
>
> I'll make sure that example is in the book as well.
>
> -- Jack Krupansky
>
> -----Original Message----- From: Jack Krupansky
> Sent: Tuesday, May 21, 2013 11:37 AM
>
> To: solr-user@lucene.apache.org
> Subject: Re: Expanding sets of words
>
> Hmmm... I did a quick test and quoted phrase wasn't working for me either.
> Oh well.
>
> But... it should work for the LucidWorks Search query parser!
>
> -- Jack Krupansky
>
> -----Original Message----- From: Mike Hugo
> Sent: Tuesday, May 21, 2013 11:26 AM
> To: solr-user@lucene.apache.org
> Subject: Re: Expanding sets of words
>
> I'll buy that book :)
>
> Does this work with mutli-word terms?
>
> (common lisp or assembly language)
> (programming or coding or development)
>
>
> I tried:
>
> {!surround}(common lisp OR assembly language) W (programming)
>
> but that returns a parse error.
>
> Putting quotes around the multi-word terms parses but returns 0 results
>
> {!surround}("common lisp" OR "assembly language") W (programming)
>
>
> On Tue, May 21, 2013 at 8:32 AM, Jack Krupansky
> <ja...@basetechnology.com>**wrote:
>
>  I'll make sure to include that specific example in the new Solr book.
>>
>>
>> -- Jack Krupansky
>>
>> -----Original Message----- From: Mike Hugo
>> Sent: Tuesday, May 21, 2013 12:29 AM
>> To: solr-user@lucene.apache.org
>> Subject: Re: Expanding sets of words
>>
>>
>> Fantastic!  Thanks!
>>
>>
>> On Mon, May 20, 2013 at 11:21 PM, Jack Krupansky <jack@basetechnology.com
>> >
>> **wrote:
>>
>>  Yes, with the Solr "surround" query parser:
>>
>>>
>>> q=(java OR groovy OR scala) W (programming OR coding OR development)
>>>
>>> BUT... there is the caveat that the surround query parser does no
>>> analysis. So, maybe you need "Java OR java" etc. Or, if you know that the
>>> index is lower case.
>>>
>>> Try this dataset:
>>>
>>> curl http://localhost:8983/solr/******collection1/update?commit=**true<http://localhost:8983/solr/****collection1/update?commit=true>
>>> <http://localhost:8983/**solr/**collection1/update?**commit=true<http://localhost:8983/solr/**collection1/update?commit=true>
>>> >
>>> **<http://localhost:8983/solr/****collection1/update?commit=**true<http://localhost:8983/solr/**collection1/update?commit=true>
>>> <http://localhost:8983/**solr/collection1/update?**commit=true<http://localhost:8983/solr/collection1/update?commit=true>
>>> >
>>> **>-H 'Content-type:application/csv' -d '
>>>
>>> id,features
>>> doc-1,java coding
>>> doc-2,java programming
>>> doc-3,java development
>>> doc-4,groovy coding
>>> doc-5,groovy programming
>>> doc-6,groovy development
>>> doc-7,scala coding
>>> doc-8,scala programming
>>> doc-9,scala development
>>> doc-10,c coding
>>> doc-11,c programming
>>> doc-12,c development
>>> doc-13,java language
>>> doc-14,groovy language
>>> doc-15,scala language'
>>>
>>> And try these commands:
>>>
>>> curl "http://localhost:8983/solr/******select/?q=(java+OR+scala)+W+****<http://localhost:8983/solr/****select/?q=(java+OR+scala)+W+**>
>>> <http://localhost:8983/solr/****select/?q=(java+OR+scala)+W+****<http://localhost:8983/solr/**select/?q=(java+OR+scala)+W+**>
>>> >
>>> programming\<http://localhost:****8983/solr/select/?q=(java+**OR+**
>>> scala)+W+programming%5C<http:/**/localhost:8983/solr/select/?**
>>> q=(java+OR+scala)+W+**programming%5C<http://localhost:8983/solr/select/?q=(java+OR+scala)+W+programming%5C>
>>> >
>>> >
>>> &df=features&defType=surround&******indent=true"
>>>
>>> curl "http://localhost:8983/solr/******select/<http://localhost:8983/solr/****select/>
>>> <http://localhost:**8983/solr/**select/<http://localhost:8983/solr/**select/>
>>> >
>>> <http://localhost:8983/**solr/**select/<http://localhost:8983/**solr/select/>
>>> <http://localhost:8983/**solr/select/<http://localhost:8983/solr/select/>
>>> >
>>> >
>>> ?\
>>> q=(java+OR+scala)+W+(******programming+OR+coding)\
>>> &df=features&defType=surround&******indent=true"
>>>
>>> curl "http://localhost:8983/solr/******select/\<http://localhost:8983/solr/****select/%5C>
>>> <http://localhost:**8983/solr/**select/%5C<http://localhost:8983/solr/**select/%5C>
>>> >
>>> <http://localhost:**8983/solr/**select/%5C<http://localhost:**
>>> 8983/solr/select/%5C <http://localhost:8983/solr/select/%5C>>
>>> >
>>> ?q=(java+OR+groovy+OR+scala)+******W+(programming+OR+coding+**OR+***
>>> *development)\
>>> &df=features&defType=surround&******indent=true"
>>>
>>>
>>> The LucidWorks Search query parser also supports NEAR, BEFORE, and AFTER
>>> operators, in conjunction with OR and "-" to generate span queries:
>>>
>>> q=(java OR groovy OR scala) BEFORE:0 (programming OR coding OR
>>> development)
>>>
>>> -- Jack Krupansky
>>>
>>> -----Original Message----- From: Mike Hugo
>>> Sent: Monday, May 20, 2013 11:42 PM
>>> To: solr-user@lucene.apache.org
>>> Subject: Expanding sets of words
>>>
>>>
>>> Is there a way to query for combinations of two sets of words?  For
>>> example, if I had
>>>
>>> (java or groovy or scala)
>>> (programming or coding or development)
>>>
>>> Is there a query parser that, at query time, would expand that into
>>> combinations like
>>>
>>> java programming
>>> groovy programming
>>> scala programming
>>> java coding
>>> java development
>>> ....
>>> etc etc etc
>>>
>>> Thanks!
>>>
>>> Mike
>>>
>>>
>>>
>>

Re: Expanding sets of words

Posted by Jack Krupansky <ja...@basetechnology.com>.
Ah... and the answer is:

curl 
"http://localhost:8983/solr/select/?q=(assembly+W+language+OR+scala)+W+programming\
&df=features&defType=surround&indent=true"

IOW, any quoted phrase like "a b c d" can be written in surround as a W b W 
c W d.

Presto!

I'll make sure that example is in the book as well.

-- Jack Krupansky

-----Original Message----- 
From: Jack Krupansky
Sent: Tuesday, May 21, 2013 11:37 AM
To: solr-user@lucene.apache.org
Subject: Re: Expanding sets of words

Hmmm... I did a quick test and quoted phrase wasn't working for me either.
Oh well.

But... it should work for the LucidWorks Search query parser!

-- Jack Krupansky

-----Original Message----- 
From: Mike Hugo
Sent: Tuesday, May 21, 2013 11:26 AM
To: solr-user@lucene.apache.org
Subject: Re: Expanding sets of words

I'll buy that book :)

Does this work with mutli-word terms?

(common lisp or assembly language)
(programming or coding or development)


I tried:

{!surround}(common lisp OR assembly language) W (programming)

but that returns a parse error.

Putting quotes around the multi-word terms parses but returns 0 results

{!surround}("common lisp" OR "assembly language") W (programming)


On Tue, May 21, 2013 at 8:32 AM, Jack Krupansky
<ja...@basetechnology.com>wrote:

> I'll make sure to include that specific example in the new Solr book.
>
>
> -- Jack Krupansky
>
> -----Original Message----- From: Mike Hugo
> Sent: Tuesday, May 21, 2013 12:29 AM
> To: solr-user@lucene.apache.org
> Subject: Re: Expanding sets of words
>
>
> Fantastic!  Thanks!
>
>
> On Mon, May 20, 2013 at 11:21 PM, Jack Krupansky <ja...@basetechnology.com>
> **wrote:
>
>  Yes, with the Solr "surround" query parser:
>>
>> q=(java OR groovy OR scala) W (programming OR coding OR development)
>>
>> BUT... there is the caveat that the surround query parser does no
>> analysis. So, maybe you need "Java OR java" etc. Or, if you know that the
>> index is lower case.
>>
>> Try this dataset:
>>
>> curl 
>> http://localhost:8983/solr/****collection1/update?commit=true<http://localhost:8983/solr/**collection1/update?commit=true>
>> **<http://localhost:8983/solr/**collection1/update?commit=true<http://localhost:8983/solr/collection1/update?commit=true>
>> **>-H 'Content-type:application/csv' -d '
>>
>> id,features
>> doc-1,java coding
>> doc-2,java programming
>> doc-3,java development
>> doc-4,groovy coding
>> doc-5,groovy programming
>> doc-6,groovy development
>> doc-7,scala coding
>> doc-8,scala programming
>> doc-9,scala development
>> doc-10,c coding
>> doc-11,c programming
>> doc-12,c development
>> doc-13,java language
>> doc-14,groovy language
>> doc-15,scala language'
>>
>> And try these commands:
>>
>> curl 
>> "http://localhost:8983/solr/****select/?q=(java+OR+scala)+W+**<http://localhost:8983/solr/**select/?q=(java+OR+scala)+W+**>
>> programming\<http://localhost:**8983/solr/select/?q=(java+OR+**
>> scala)+W+programming%5C<http://localhost:8983/solr/select/?q=(java+OR+scala)+W+programming%5C>
>> >
>> &df=features&defType=surround&****indent=true"
>>
>> curl 
>> "http://localhost:8983/solr/****select/<http://localhost:8983/solr/**select/>
>> <http://localhost:8983/**solr/select/<http://localhost:8983/solr/select/>
>> >
>> ?\
>> q=(java+OR+scala)+W+(****programming+OR+coding)\
>> &df=features&defType=surround&****indent=true"
>>
>> curl 
>> "http://localhost:8983/solr/****select/\<http://localhost:8983/solr/**select/%5C>
>> <http://localhost:**8983/solr/select/%5C<http://localhost:8983/solr/select/%5C>
>> >
>> ?q=(java+OR+groovy+OR+scala)+****W+(programming+OR+coding+OR+***
>> *development)\
>> &df=features&defType=surround&****indent=true"
>>
>>
>> The LucidWorks Search query parser also supports NEAR, BEFORE, and AFTER
>> operators, in conjunction with OR and "-" to generate span queries:
>>
>> q=(java OR groovy OR scala) BEFORE:0 (programming OR coding OR
>> development)
>>
>> -- Jack Krupansky
>>
>> -----Original Message----- From: Mike Hugo
>> Sent: Monday, May 20, 2013 11:42 PM
>> To: solr-user@lucene.apache.org
>> Subject: Expanding sets of words
>>
>>
>> Is there a way to query for combinations of two sets of words?  For
>> example, if I had
>>
>> (java or groovy or scala)
>> (programming or coding or development)
>>
>> Is there a query parser that, at query time, would expand that into
>> combinations like
>>
>> java programming
>> groovy programming
>> scala programming
>> java coding
>> java development
>> ....
>> etc etc etc
>>
>> Thanks!
>>
>> Mike
>>
>>
> 

Re: Expanding sets of words

Posted by Jack Krupansky <ja...@basetechnology.com>.
Hmmm... I did a quick test and quoted phrase wasn't working for me either. 
Oh well.

But... it should work for the LucidWorks Search query parser!

-- Jack Krupansky

-----Original Message----- 
From: Mike Hugo
Sent: Tuesday, May 21, 2013 11:26 AM
To: solr-user@lucene.apache.org
Subject: Re: Expanding sets of words

I'll buy that book :)

Does this work with mutli-word terms?

(common lisp or assembly language)
(programming or coding or development)


I tried:

{!surround}(common lisp OR assembly language) W (programming)

but that returns a parse error.

Putting quotes around the multi-word terms parses but returns 0 results

{!surround}("common lisp" OR "assembly language") W (programming)


On Tue, May 21, 2013 at 8:32 AM, Jack Krupansky 
<ja...@basetechnology.com>wrote:

> I'll make sure to include that specific example in the new Solr book.
>
>
> -- Jack Krupansky
>
> -----Original Message----- From: Mike Hugo
> Sent: Tuesday, May 21, 2013 12:29 AM
> To: solr-user@lucene.apache.org
> Subject: Re: Expanding sets of words
>
>
> Fantastic!  Thanks!
>
>
> On Mon, May 20, 2013 at 11:21 PM, Jack Krupansky <ja...@basetechnology.com>
> **wrote:
>
>  Yes, with the Solr "surround" query parser:
>>
>> q=(java OR groovy OR scala) W (programming OR coding OR development)
>>
>> BUT... there is the caveat that the surround query parser does no
>> analysis. So, maybe you need "Java OR java" etc. Or, if you know that the
>> index is lower case.
>>
>> Try this dataset:
>>
>> curl 
>> http://localhost:8983/solr/****collection1/update?commit=true<http://localhost:8983/solr/**collection1/update?commit=true>
>> **<http://localhost:8983/solr/**collection1/update?commit=true<http://localhost:8983/solr/collection1/update?commit=true>
>> **>-H 'Content-type:application/csv' -d '
>>
>> id,features
>> doc-1,java coding
>> doc-2,java programming
>> doc-3,java development
>> doc-4,groovy coding
>> doc-5,groovy programming
>> doc-6,groovy development
>> doc-7,scala coding
>> doc-8,scala programming
>> doc-9,scala development
>> doc-10,c coding
>> doc-11,c programming
>> doc-12,c development
>> doc-13,java language
>> doc-14,groovy language
>> doc-15,scala language'
>>
>> And try these commands:
>>
>> curl 
>> "http://localhost:8983/solr/****select/?q=(java+OR+scala)+W+**<http://localhost:8983/solr/**select/?q=(java+OR+scala)+W+**>
>> programming\<http://localhost:**8983/solr/select/?q=(java+OR+**
>> scala)+W+programming%5C<http://localhost:8983/solr/select/?q=(java+OR+scala)+W+programming%5C>
>> >
>> &df=features&defType=surround&****indent=true"
>>
>> curl 
>> "http://localhost:8983/solr/****select/<http://localhost:8983/solr/**select/>
>> <http://localhost:8983/**solr/select/<http://localhost:8983/solr/select/>
>> >
>> ?\
>> q=(java+OR+scala)+W+(****programming+OR+coding)\
>> &df=features&defType=surround&****indent=true"
>>
>> curl 
>> "http://localhost:8983/solr/****select/\<http://localhost:8983/solr/**select/%5C>
>> <http://localhost:**8983/solr/select/%5C<http://localhost:8983/solr/select/%5C>
>> >
>> ?q=(java+OR+groovy+OR+scala)+****W+(programming+OR+coding+OR+***
>> *development)\
>> &df=features&defType=surround&****indent=true"
>>
>>
>> The LucidWorks Search query parser also supports NEAR, BEFORE, and AFTER
>> operators, in conjunction with OR and "-" to generate span queries:
>>
>> q=(java OR groovy OR scala) BEFORE:0 (programming OR coding OR
>> development)
>>
>> -- Jack Krupansky
>>
>> -----Original Message----- From: Mike Hugo
>> Sent: Monday, May 20, 2013 11:42 PM
>> To: solr-user@lucene.apache.org
>> Subject: Expanding sets of words
>>
>>
>> Is there a way to query for combinations of two sets of words?  For
>> example, if I had
>>
>> (java or groovy or scala)
>> (programming or coding or development)
>>
>> Is there a query parser that, at query time, would expand that into
>> combinations like
>>
>> java programming
>> groovy programming
>> scala programming
>> java coding
>> java development
>> ....
>> etc etc etc
>>
>> Thanks!
>>
>> Mike
>>
>>
> 


Re: Expanding sets of words

Posted by Mike Hugo <mi...@piragua.com>.
I'll buy that book :)

Does this work with mutli-word terms?

(common lisp or assembly language)
(programming or coding or development)


I tried:

{!surround}(common lisp OR assembly language) W (programming)

but that returns a parse error.

Putting quotes around the multi-word terms parses but returns 0 results

{!surround}("common lisp" OR "assembly language") W (programming)


On Tue, May 21, 2013 at 8:32 AM, Jack Krupansky <ja...@basetechnology.com>wrote:

> I'll make sure to include that specific example in the new Solr book.
>
>
> -- Jack Krupansky
>
> -----Original Message----- From: Mike Hugo
> Sent: Tuesday, May 21, 2013 12:29 AM
> To: solr-user@lucene.apache.org
> Subject: Re: Expanding sets of words
>
>
> Fantastic!  Thanks!
>
>
> On Mon, May 20, 2013 at 11:21 PM, Jack Krupansky <ja...@basetechnology.com>
> **wrote:
>
>  Yes, with the Solr "surround" query parser:
>>
>> q=(java OR groovy OR scala) W (programming OR coding OR development)
>>
>> BUT... there is the caveat that the surround query parser does no
>> analysis. So, maybe you need "Java OR java" etc. Or, if you know that the
>> index is lower case.
>>
>> Try this dataset:
>>
>> curl http://localhost:8983/solr/****collection1/update?commit=true<http://localhost:8983/solr/**collection1/update?commit=true>
>> **<http://localhost:8983/solr/**collection1/update?commit=true<http://localhost:8983/solr/collection1/update?commit=true>
>> **>-H 'Content-type:application/csv' -d '
>>
>> id,features
>> doc-1,java coding
>> doc-2,java programming
>> doc-3,java development
>> doc-4,groovy coding
>> doc-5,groovy programming
>> doc-6,groovy development
>> doc-7,scala coding
>> doc-8,scala programming
>> doc-9,scala development
>> doc-10,c coding
>> doc-11,c programming
>> doc-12,c development
>> doc-13,java language
>> doc-14,groovy language
>> doc-15,scala language'
>>
>> And try these commands:
>>
>> curl "http://localhost:8983/solr/****select/?q=(java+OR+scala)+W+**<http://localhost:8983/solr/**select/?q=(java+OR+scala)+W+**>
>> programming\<http://localhost:**8983/solr/select/?q=(java+OR+**
>> scala)+W+programming%5C<http://localhost:8983/solr/select/?q=(java+OR+scala)+W+programming%5C>
>> >
>> &df=features&defType=surround&****indent=true"
>>
>> curl "http://localhost:8983/solr/****select/<http://localhost:8983/solr/**select/>
>> <http://localhost:8983/**solr/select/<http://localhost:8983/solr/select/>
>> >
>> ?\
>> q=(java+OR+scala)+W+(****programming+OR+coding)\
>> &df=features&defType=surround&****indent=true"
>>
>> curl "http://localhost:8983/solr/****select/\<http://localhost:8983/solr/**select/%5C>
>> <http://localhost:**8983/solr/select/%5C<http://localhost:8983/solr/select/%5C>
>> >
>> ?q=(java+OR+groovy+OR+scala)+****W+(programming+OR+coding+OR+***
>> *development)\
>> &df=features&defType=surround&****indent=true"
>>
>>
>> The LucidWorks Search query parser also supports NEAR, BEFORE, and AFTER
>> operators, in conjunction with OR and "-" to generate span queries:
>>
>> q=(java OR groovy OR scala) BEFORE:0 (programming OR coding OR
>> development)
>>
>> -- Jack Krupansky
>>
>> -----Original Message----- From: Mike Hugo
>> Sent: Monday, May 20, 2013 11:42 PM
>> To: solr-user@lucene.apache.org
>> Subject: Expanding sets of words
>>
>>
>> Is there a way to query for combinations of two sets of words?  For
>> example, if I had
>>
>> (java or groovy or scala)
>> (programming or coding or development)
>>
>> Is there a query parser that, at query time, would expand that into
>> combinations like
>>
>> java programming
>> groovy programming
>> scala programming
>> java coding
>> java development
>> ....
>> etc etc etc
>>
>> Thanks!
>>
>> Mike
>>
>>
>

Re: Expanding sets of words

Posted by Jack Krupansky <ja...@basetechnology.com>.
I'll make sure to include that specific example in the new Solr book.

-- Jack Krupansky

-----Original Message----- 
From: Mike Hugo
Sent: Tuesday, May 21, 2013 12:29 AM
To: solr-user@lucene.apache.org
Subject: Re: Expanding sets of words

Fantastic!  Thanks!


On Mon, May 20, 2013 at 11:21 PM, Jack Krupansky 
<ja...@basetechnology.com>wrote:

> Yes, with the Solr "surround" query parser:
>
> q=(java OR groovy OR scala) W (programming OR coding OR development)
>
> BUT... there is the caveat that the surround query parser does no
> analysis. So, maybe you need "Java OR java" etc. Or, if you know that the
> index is lower case.
>
> Try this dataset:
>
> curl 
> http://localhost:8983/solr/**collection1/update?commit=true<http://localhost:8983/solr/collection1/update?commit=true>-H 
> 'Content-type:application/csv' -d '
> id,features
> doc-1,java coding
> doc-2,java programming
> doc-3,java development
> doc-4,groovy coding
> doc-5,groovy programming
> doc-6,groovy development
> doc-7,scala coding
> doc-8,scala programming
> doc-9,scala development
> doc-10,c coding
> doc-11,c programming
> doc-12,c development
> doc-13,java language
> doc-14,groovy language
> doc-15,scala language'
>
> And try these commands:
>
> curl "http://localhost:8983/solr/**select/?q=(java+OR+scala)+W+**
> programming\<http://localhost:8983/solr/select/?q=(java+OR+scala)+W+programming%5C>
> &df=features&defType=surround&**indent=true"
>
> curl 
> "http://localhost:8983/solr/**select/<http://localhost:8983/solr/select/>
> ?\
> q=(java+OR+scala)+W+(**programming+OR+coding)\
> &df=features&defType=surround&**indent=true"
>
> curl 
> "http://localhost:8983/solr/**select/\<http://localhost:8983/solr/select/%5C>
> ?q=(java+OR+groovy+OR+scala)+**W+(programming+OR+coding+OR+**development)\
> &df=features&defType=surround&**indent=true"
>
> The LucidWorks Search query parser also supports NEAR, BEFORE, and AFTER
> operators, in conjunction with OR and "-" to generate span queries:
>
> q=(java OR groovy OR scala) BEFORE:0 (programming OR coding OR 
> development)
>
> -- Jack Krupansky
>
> -----Original Message----- From: Mike Hugo
> Sent: Monday, May 20, 2013 11:42 PM
> To: solr-user@lucene.apache.org
> Subject: Expanding sets of words
>
>
> Is there a way to query for combinations of two sets of words?  For
> example, if I had
>
> (java or groovy or scala)
> (programming or coding or development)
>
> Is there a query parser that, at query time, would expand that into
> combinations like
>
> java programming
> groovy programming
> scala programming
> java coding
> java development
> ....
> etc etc etc
>
> Thanks!
>
> Mike
> 


Re: Expanding sets of words

Posted by Mike Hugo <mi...@piragua.com>.
Fantastic!  Thanks!


On Mon, May 20, 2013 at 11:21 PM, Jack Krupansky <ja...@basetechnology.com>wrote:

> Yes, with the Solr "surround" query parser:
>
> q=(java OR groovy OR scala) W (programming OR coding OR development)
>
> BUT... there is the caveat that the surround query parser does no
> analysis. So, maybe you need "Java OR java" etc. Or, if you know that the
> index is lower case.
>
> Try this dataset:
>
> curl http://localhost:8983/solr/**collection1/update?commit=true<http://localhost:8983/solr/collection1/update?commit=true>-H 'Content-type:application/csv' -d '
> id,features
> doc-1,java coding
> doc-2,java programming
> doc-3,java development
> doc-4,groovy coding
> doc-5,groovy programming
> doc-6,groovy development
> doc-7,scala coding
> doc-8,scala programming
> doc-9,scala development
> doc-10,c coding
> doc-11,c programming
> doc-12,c development
> doc-13,java language
> doc-14,groovy language
> doc-15,scala language'
>
> And try these commands:
>
> curl "http://localhost:8983/solr/**select/?q=(java+OR+scala)+W+**
> programming\<http://localhost:8983/solr/select/?q=(java+OR+scala)+W+programming%5C>
> &df=features&defType=surround&**indent=true"
>
> curl "http://localhost:8983/solr/**select/<http://localhost:8983/solr/select/>
> ?\
> q=(java+OR+scala)+W+(**programming+OR+coding)\
> &df=features&defType=surround&**indent=true"
>
> curl "http://localhost:8983/solr/**select/\<http://localhost:8983/solr/select/%5C>
> ?q=(java+OR+groovy+OR+scala)+**W+(programming+OR+coding+OR+**development)\
> &df=features&defType=surround&**indent=true"
>
> The LucidWorks Search query parser also supports NEAR, BEFORE, and AFTER
> operators, in conjunction with OR and "-" to generate span queries:
>
> q=(java OR groovy OR scala) BEFORE:0 (programming OR coding OR development)
>
> -- Jack Krupansky
>
> -----Original Message----- From: Mike Hugo
> Sent: Monday, May 20, 2013 11:42 PM
> To: solr-user@lucene.apache.org
> Subject: Expanding sets of words
>
>
> Is there a way to query for combinations of two sets of words?  For
> example, if I had
>
> (java or groovy or scala)
> (programming or coding or development)
>
> Is there a query parser that, at query time, would expand that into
> combinations like
>
> java programming
> groovy programming
> scala programming
> java coding
> java development
> ....
> etc etc etc
>
> Thanks!
>
> Mike
>

Re: Expanding sets of words

Posted by Jack Krupansky <ja...@basetechnology.com>.
Yes, with the Solr "surround" query parser:

q=(java OR groovy OR scala) W (programming OR coding OR development)

BUT... there is the caveat that the surround query parser does no analysis. 
So, maybe you need "Java OR java" etc. Or, if you know that the index is 
lower case.

Try this dataset:

curl http://localhost:8983/solr/collection1/update?commit=true -H 
'Content-type:application/csv' -d '
id,features
doc-1,java coding
doc-2,java programming
doc-3,java development
doc-4,groovy coding
doc-5,groovy programming
doc-6,groovy development
doc-7,scala coding
doc-8,scala programming
doc-9,scala development
doc-10,c coding
doc-11,c programming
doc-12,c development
doc-13,java language
doc-14,groovy language
doc-15,scala language'

And try these commands:

curl "http://localhost:8983/solr/select/?q=(java+OR+scala)+W+programming\
&df=features&defType=surround&indent=true"

curl "http://localhost:8983/solr/select/?\
q=(java+OR+scala)+W+(programming+OR+coding)\
&df=features&defType=surround&indent=true"

curl "http://localhost:8983/solr/select/\
?q=(java+OR+groovy+OR+scala)+W+(programming+OR+coding+OR+development)\
&df=features&defType=surround&indent=true"

The LucidWorks Search query parser also supports NEAR, BEFORE, and AFTER 
operators, in conjunction with OR and "-" to generate span queries:

q=(java OR groovy OR scala) BEFORE:0 (programming OR coding OR development)

-- Jack Krupansky

-----Original Message----- 
From: Mike Hugo
Sent: Monday, May 20, 2013 11:42 PM
To: solr-user@lucene.apache.org
Subject: Expanding sets of words

Is there a way to query for combinations of two sets of words?  For
example, if I had

(java or groovy or scala)
(programming or coding or development)

Is there a query parser that, at query time, would expand that into
combinations like

java programming
groovy programming
scala programming
java coding
java development
....
etc etc etc

Thanks!

Mike 


Re: Expanding sets of words

Posted by Gora Mohanty <go...@mimirtech.com>.
On 21 May 2013 09:12, Mike Hugo <mi...@piragua.com> wrote:
> Is there a way to query for combinations of two sets of words?  For
> example, if I had
>
> (java or groovy or scala)
> (programming or coding or development)
>
> Is there a query parser that, at query time, would expand that into
> combinations like
>
> java programming
> groovy programming
> scala programming
> java coding
> java development
> ....
> etc etc etc

How many such combinations are there? If these are limited
in number, and can be pre-defined, the easiest way might be
to use synonyms:
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory

If that does not meet your needs, you will probably need to
write a custom query parser, which is not too difficult:
http://wiki.apache.org/solr/SolrPlugins#QParserPlugin

Regards,
Gora