Is SQL Like operator feature available in Apache Solr query

2011-11-01 Thread arshad ansari
Hi,

Is SQL Like operator feature available in Apache Solr Just like we have it
in SQL.

SQL example below -

*Select * from Employee where employee_name like '%Solr%'*

If not is it a Bug with Solr. If this feature available, please tell the
examples available.

Thanks!

-- 
Best Regards,
Arshad


Re: Is SQL Like operator feature available in Apache Solr query

2011-11-01 Thread François Schiettecatte
Arshad

Actually it is available, you need to use the ReversedWildcardFilterFactory 
which I am sure you can Google for.

Solr and SQL address different problem sets with some overlaps but there are 
significant differences between the two technologies. Actually '%Solr%' is a 
worse case for SQL but handled quite elegantly in Solr.

Hope this helps!

Cheers

François


On Nov 1, 2011, at 7:46 AM, arshad ansari wrote:

> Hi,
> 
> Is SQL Like operator feature available in Apache Solr Just like we have it
> in SQL.
> 
> SQL example below -
> 
> *Select * from Employee where employee_name like '%Solr%'*
> 
> If not is it a Bug with Solr. If this feature available, please tell the
> examples available.
> 
> Thanks!
> 
> -- 
> Best Regards,
> Arshad



Re: Is SQL Like operator feature available in Apache Solr query

2011-11-01 Thread Michael Kuhlmann

Hi,

this is not exactly true. In Solr, you can't have the wildcard operator 
on both sides of the operator.


However, you can tokenize your fields and simply query for "Solr". This 
is what's Solr made for. :)


-Kuli

Am 01.11.2011 13:24, schrieb François Schiettecatte:

Arshad

Actually it is available, you need to use the ReversedWildcardFilterFactory 
which I am sure you can Google for.

Solr and SQL address different problem sets with some overlaps but there are 
significant differences between the two technologies. Actually '%Solr%' is a 
worse case for SQL but handled quite elegantly in Solr.

Hope this helps!

Cheers

François


On Nov 1, 2011, at 7:46 AM, arshad ansari wrote:


Hi,

Is SQL Like operator feature available in Apache Solr Just like we have it
in SQL.

SQL example below -

*Select * from Employee where employee_name like '%Solr%'*

If not is it a Bug with Solr. If this feature available, please tell the
examples available.

Thanks!

--
Best Regards,
Arshad






Re: Is SQL Like operator feature available in Apache Solr query

2011-11-01 Thread François Schiettecatte
Kuli

Good point about just tokenizing the fields :)

I ran a couple of tests to double-check my understanding and you can have a 
wildcard operator at either or both ends of a term. Adding 
ReversedWildcardFilterFactory to your field analyzer will make leading wildcard 
searches a lot faster of course but at the expense of index size.

Cheers

François


On Nov 1, 2011, at 9:07 AM, Michael Kuhlmann wrote:

> Hi,
> 
> this is not exactly true. In Solr, you can't have the wildcard operator on 
> both sides of the operator.
> 
> However, you can tokenize your fields and simply query for "Solr". This is 
> what's Solr made for. :)
> 
> -Kuli
> 
> Am 01.11.2011 13:24, schrieb François Schiettecatte:
>> Arshad
>> 
>> Actually it is available, you need to use the ReversedWildcardFilterFactory 
>> which I am sure you can Google for.
>> 
>> Solr and SQL address different problem sets with some overlaps but there are 
>> significant differences between the two technologies. Actually '%Solr%' is a 
>> worse case for SQL but handled quite elegantly in Solr.
>> 
>> Hope this helps!
>> 
>> Cheers
>> 
>> François
>> 
>> 
>> On Nov 1, 2011, at 7:46 AM, arshad ansari wrote:
>> 
>>> Hi,
>>> 
>>> Is SQL Like operator feature available in Apache Solr Just like we have it
>>> in SQL.
>>> 
>>> SQL example below -
>>> 
>>> *Select * from Employee where employee_name like '%Solr%'*
>>> 
>>> If not is it a Bug with Solr. If this feature available, please tell the
>>> examples available.
>>> 
>>> Thanks!
>>> 
>>> --
>>> Best Regards,
>>> Arshad
>> 
> 



Re: Is SQL Like operator feature available in Apache Solr query

2011-11-01 Thread Erick Erickson
NGrams are often used in Solr for this case, but they will also add to
your index size.

It might be worthwhile to look closely at your user requirements
before going ahead
and supporting this functionality

Best
Erick

2011/11/1 François Schiettecatte :
> Kuli
>
> Good point about just tokenizing the fields :)
>
> I ran a couple of tests to double-check my understanding and you can have a 
> wildcard operator at either or both ends of a term. Adding 
> ReversedWildcardFilterFactory to your field analyzer will make leading 
> wildcard searches a lot faster of course but at the expense of index size.
>
> Cheers
>
> François
>
>
> On Nov 1, 2011, at 9:07 AM, Michael Kuhlmann wrote:
>
>> Hi,
>>
>> this is not exactly true. In Solr, you can't have the wildcard operator on 
>> both sides of the operator.
>>
>> However, you can tokenize your fields and simply query for "Solr". This is 
>> what's Solr made for. :)
>>
>> -Kuli
>>
>> Am 01.11.2011 13:24, schrieb François Schiettecatte:
>>> Arshad
>>>
>>> Actually it is available, you need to use the ReversedWildcardFilterFactory 
>>> which I am sure you can Google for.
>>>
>>> Solr and SQL address different problem sets with some overlaps but there 
>>> are significant differences between the two technologies. Actually '%Solr%' 
>>> is a worse case for SQL but handled quite elegantly in Solr.
>>>
>>> Hope this helps!
>>>
>>> Cheers
>>>
>>> François
>>>
>>>
>>> On Nov 1, 2011, at 7:46 AM, arshad ansari wrote:
>>>
 Hi,

 Is SQL Like operator feature available in Apache Solr Just like we have it
 in SQL.

 SQL example below -

 *Select * from Employee where employee_name like '%Solr%'*

 If not is it a Bug with Solr. If this feature available, please tell the
 examples available.

 Thanks!

 --
 Best Regards,
 Arshad
>>>
>>
>
>


Re: Is SQL Like operator feature available in Apache Solr query

2011-11-01 Thread Michael Kuhlmann

Am 01.11.2011 16:06, schrieb Erick Erickson:

NGrams are often used in Solr for this case, but they will also add to
your index size.

It might be worthwhile to look closely at your user requirements
before going ahead
and supporting this functionality

Best
Erick


My opinion. Wildcards are good for "peeking into the index", i.e. for 
checking data in the browser. I haven't yet found a real life use case 
for them.


-Kuli


Re: Is SQL Like operator feature available in Apache Solr query

2011-11-01 Thread Memory Makers
Eric,

NGrams could you elaborate on that ? -- haven't seen that before.

Thanks.

On Tue, Nov 1, 2011 at 11:06 AM, Erick Erickson wrote:

> NGrams are often used in Solr for this case, but they will also add to
> your index size.
>
> It might be worthwhile to look closely at your user requirements
> before going ahead
> and supporting this functionality
>
> Best
> Erick
>
> 2011/11/1 François Schiettecatte :
> > Kuli
> >
> > Good point about just tokenizing the fields :)
> >
> > I ran a couple of tests to double-check my understanding and you can
> have a wildcard operator at either or both ends of a term. Adding
> ReversedWildcardFilterFactory to your field analyzer will make leading
> wildcard searches a lot faster of course but at the expense of index size.
> >
> > Cheers
> >
> > François
> >
> >
> > On Nov 1, 2011, at 9:07 AM, Michael Kuhlmann wrote:
> >
> >> Hi,
> >>
> >> this is not exactly true. In Solr, you can't have the wildcard operator
> on both sides of the operator.
> >>
> >> However, you can tokenize your fields and simply query for "Solr". This
> is what's Solr made for. :)
> >>
> >> -Kuli
> >>
> >> Am 01.11.2011 13:24, schrieb François Schiettecatte:
> >>> Arshad
> >>>
> >>> Actually it is available, you need to use the
> ReversedWildcardFilterFactory which I am sure you can Google for.
> >>>
> >>> Solr and SQL address different problem sets with some overlaps but
> there are significant differences between the two technologies. Actually
> '%Solr%' is a worse case for SQL but handled quite elegantly in Solr.
> >>>
> >>> Hope this helps!
> >>>
> >>> Cheers
> >>>
> >>> François
> >>>
> >>>
> >>> On Nov 1, 2011, at 7:46 AM, arshad ansari wrote:
> >>>
>  Hi,
> 
>  Is SQL Like operator feature available in Apache Solr Just like we
> have it
>  in SQL.
> 
>  SQL example below -
> 
>  *Select * from Employee where employee_name like '%Solr%'*
> 
>  If not is it a Bug with Solr. If this feature available, please tell
> the
>  examples available.
> 
>  Thanks!
> 
>  --
>  Best Regards,
>  Arshad
> >>>
> >>
> >
> >
>


Re: Is SQL Like operator feature available in Apache Solr query

2011-11-01 Thread Erick Erickson
Start here: 
http://lucene.apache.org/solr/api/org/apache/solr/analysis/NGramFilterFactory.html

But the idea is that you define a field with the NGramFilterFactory and it
indexes, (here are bigrams) mysolrstuff as separate tokens: my ys so ol lr
rs st tu uf ff. This supports the %solr% idea if you strip off the % and
bigram the text, you search for so ol lr which matches. You can do some
tricks with phrase queries to make sure it exactly matches only those three
tokens one right after the other.

Of course this expands your index significantly.

Best
Erick

On Tue, Nov 1, 2011 at 11:45 AM, Memory Makers  wrote:
> Eric,
>
> NGrams could you elaborate on that ? -- haven't seen that before.
>
> Thanks.
>
> On Tue, Nov 1, 2011 at 11:06 AM, Erick Erickson 
> wrote:
>
>> NGrams are often used in Solr for this case, but they will also add to
>> your index size.
>>
>> It might be worthwhile to look closely at your user requirements
>> before going ahead
>> and supporting this functionality
>>
>> Best
>> Erick
>>
>> 2011/11/1 François Schiettecatte :
>> > Kuli
>> >
>> > Good point about just tokenizing the fields :)
>> >
>> > I ran a couple of tests to double-check my understanding and you can
>> have a wildcard operator at either or both ends of a term. Adding
>> ReversedWildcardFilterFactory to your field analyzer will make leading
>> wildcard searches a lot faster of course but at the expense of index size.
>> >
>> > Cheers
>> >
>> > François
>> >
>> >
>> > On Nov 1, 2011, at 9:07 AM, Michael Kuhlmann wrote:
>> >
>> >> Hi,
>> >>
>> >> this is not exactly true. In Solr, you can't have the wildcard operator
>> on both sides of the operator.
>> >>
>> >> However, you can tokenize your fields and simply query for "Solr". This
>> is what's Solr made for. :)
>> >>
>> >> -Kuli
>> >>
>> >> Am 01.11.2011 13:24, schrieb François Schiettecatte:
>> >>> Arshad
>> >>>
>> >>> Actually it is available, you need to use the
>> ReversedWildcardFilterFactory which I am sure you can Google for.
>> >>>
>> >>> Solr and SQL address different problem sets with some overlaps but
>> there are significant differences between the two technologies. Actually
>> '%Solr%' is a worse case for SQL but handled quite elegantly in Solr.
>> >>>
>> >>> Hope this helps!
>> >>>
>> >>> Cheers
>> >>>
>> >>> François
>> >>>
>> >>>
>> >>> On Nov 1, 2011, at 7:46 AM, arshad ansari wrote:
>> >>>
>>  Hi,
>> 
>>  Is SQL Like operator feature available in Apache Solr Just like we
>> have it
>>  in SQL.
>> 
>>  SQL example below -
>> 
>>  *Select * from Employee where employee_name like '%Solr%'*
>> 
>>  If not is it a Bug with Solr. If this feature available, please tell
>> the
>>  examples available.
>> 
>>  Thanks!
>> 
>>  --
>>  Best Regards,
>>  Arshad
>> >>>
>> >>
>> >
>> >
>>
>