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 Joel Nylund <jn...@yahoo.com> on 2009/11/04 15:08:03 UTC

solr query help alpha numeric and not

Hi, I have a field called firstLetterTitle, this field has 1 char, it  
can be anything, I need help with a few queries on this char:

1.) I want all NON ALPHA and NON numbers, so any char that is not A-Z  
or 0-9

I tried:

http://localhost:8983/solr/select?q=NOT%20firstLetterTitle:0%20TO%209%20AND%20NOT%20firstLetterTitle:A%20TO%20Z

But I get back numeric results:

<doc>
<str name="firstLetterTitle">9</str>
<str name="id">23946447</str>
</doc>


2.) I want all only Numerics:

http://localhost:8983/solr/select?q=firstLetterTitle:0%20TO%209

This seems to work but just checking if its the right way.



2.) I want all only English Letters:

http://localhost:8983/solr/select?q=firstLetterTitle:A%20TO%20Z

This seems to work but just checking if its the right way.


thanks
Joel


Re: solr query help alpha numeric and not

Posted by Avlesh Singh <av...@gmail.com>.
In all your examples, you seem to be using an incorrect range query syntax.
Turn on the debugQuery parameter in your query and you would realize that
your query was parsed in an unexpected way.

For your use-cases, look inline -

1.) I want all NON ALPHA and NON numbers, so any char that is not A-Z or 0-9
>
This should work -
http://localhost:8983/solr/select?q=-(firstLetterTitle%3A[A+TO+Z]+firstLetterTitle%3A[0+TO+9])<http://localhost:8983/solr/select?q=-%28firstLetterTitle%3A%5BA+TO+Z%5D+firstLetterTitle%3A%5B0+TO+9%5D%29>

2.) I want all only Numerics:
>
This should work -
http://localhost:8983/solr/select?q=firstLetterTitle%3A[0+TO+9]<http://localhost:8983/solr/select?q=firstLetterTitle%3A%5B0+TO+9%5D>

3) I want all only English Letters:
>
This should work -
http://localhost:8983/solr/select?q=firstLetterTitle%3A[A+TO+Z]<http://localhost:8983/solr/select?q=firstLetterTitle%3A%5BA+TO+Z%5D>

For more on solr query syntax, read here -
http://wiki.apache.org/solr/SolrQuerySyntax

Cheers
Avlesh

On Wed, Nov 4, 2009 at 7:38 PM, Joel Nylund <jn...@yahoo.com> wrote:

> Hi, I have a field called firstLetterTitle, this field has 1 char, it can
> be anything, I need help with a few queries on this char:
>
> 1.) I want all NON ALPHA and NON numbers, so any char that is not A-Z or
> 0-9
>
> I tried:
>
>
> http://localhost:8983/solr/select?q=NOT%20firstLetterTitle:0%20TO%209%20AND%20NOT%20firstLetterTitle:A%20TO%20Z
>
> But I get back numeric results:
>
> <doc>
> <str name="firstLetterTitle">9</str>
> <str name="id">23946447</str>
> </doc>
>
>
> 2.) I want all only Numerics:
>
> http://localhost:8983/solr/select?q=firstLetterTitle:0%20TO%209
>
> This seems to work but just checking if its the right way.
>
>
>
> 2.) I want all only English Letters:
>
> http://localhost:8983/solr/select?q=firstLetterTitle:A%20TO%20Z
>
> This seems to work but just checking if its the right way.
>
>
> thanks
> Joel
>
>

Re: solr query help alpha numeric and not

Posted by Joel Nylund <jn...@yahoo.com>.
Avlesh, thanks those worked, for somre reason I never got your mail,  
found it in one of the list archives though.

thanks again
Joel

On Nov 5, 2009, at 9:08 PM, Avlesh Singh wrote:

> Didn't the queries in my reply work?
>
> Cheers
> Avlesh
>
> On Fri, Nov 6, 2009 at 4:16 AM, Joel Nylund <jn...@yahoo.com> wrote:
>
>> Hi yes its a string, in the case of a title, it can be anything, a  
>> letter a
>> number, a symbol or a multibyte char etc.
>>
>> Any ideas if I wanted a query that was not a letter a-z or a number  
>> 0-9,
>> given that its a string?
>>
>> thanks
>> Joel
>>
>>
>> On Nov 4, 2009, at 9:10 AM, Jonathan Hendler wrote:
>>
>> Hi Joel,
>>>
>>> The ID is sent back as a string (instead of as an integer) in your
>>> example. Could this be the cause?
>>>
>>> - Jonathan
>>>
>>> On Nov 4, 2009, at 9:08 AM, Joel Nylund wrote:
>>>
>>> Hi, I have a field called firstLetterTitle, this field has 1 char,  
>>> it can
>>>> be anything, I need help with a few queries on this char:
>>>>
>>>> 1.) I want all NON ALPHA and NON numbers, so any char that is not  
>>>> A-Z or
>>>> 0-9
>>>>
>>>> I tried:
>>>>
>>>>
>>>> http://localhost:8983/solr/select?q=NOT%20firstLetterTitle:0%20TO%209%20AND%20NOT%20firstLetterTitle:A%20TO%20Z
>>>>
>>>> But I get back numeric results:
>>>>
>>>> <doc>
>>>> <str name="firstLetterTitle">9</str>
>>>> <str name="id">23946447</str>
>>>> </doc>
>>>>
>>>>
>>>> 2.) I want all only Numerics:
>>>>
>>>> http://localhost:8983/solr/select?q=firstLetterTitle:0%20TO%209
>>>>
>>>> This seems to work but just checking if its the right way.
>>>>
>>>>
>>>>
>>>> 2.) I want all only English Letters:
>>>>
>>>> http://localhost:8983/solr/select?q=firstLetterTitle:A%20TO%20Z
>>>>
>>>> This seems to work but just checking if its the right way.
>>>>
>>>>
>>>> thanks
>>>> Joel
>>>>
>>>>
>>>
>>


Re: solr query help alpha numeric and not

Posted by Avlesh Singh <av...@gmail.com>.
Didn't the queries in my reply work?

Cheers
Avlesh

On Fri, Nov 6, 2009 at 4:16 AM, Joel Nylund <jn...@yahoo.com> wrote:

> Hi yes its a string, in the case of a title, it can be anything, a letter a
> number, a symbol or a multibyte char etc.
>
> Any ideas if I wanted a query that was not a letter a-z or a number 0-9,
> given that its a string?
>
> thanks
> Joel
>
>
> On Nov 4, 2009, at 9:10 AM, Jonathan Hendler wrote:
>
>  Hi Joel,
>>
>> The ID is sent back as a string (instead of as an integer) in your
>> example. Could this be the cause?
>>
>> - Jonathan
>>
>> On Nov 4, 2009, at 9:08 AM, Joel Nylund wrote:
>>
>>  Hi, I have a field called firstLetterTitle, this field has 1 char, it can
>>> be anything, I need help with a few queries on this char:
>>>
>>> 1.) I want all NON ALPHA and NON numbers, so any char that is not A-Z or
>>> 0-9
>>>
>>> I tried:
>>>
>>>
>>> http://localhost:8983/solr/select?q=NOT%20firstLetterTitle:0%20TO%209%20AND%20NOT%20firstLetterTitle:A%20TO%20Z
>>>
>>> But I get back numeric results:
>>>
>>> <doc>
>>> <str name="firstLetterTitle">9</str>
>>> <str name="id">23946447</str>
>>> </doc>
>>>
>>>
>>> 2.) I want all only Numerics:
>>>
>>> http://localhost:8983/solr/select?q=firstLetterTitle:0%20TO%209
>>>
>>> This seems to work but just checking if its the right way.
>>>
>>>
>>>
>>> 2.) I want all only English Letters:
>>>
>>> http://localhost:8983/solr/select?q=firstLetterTitle:A%20TO%20Z
>>>
>>> This seems to work but just checking if its the right way.
>>>
>>>
>>> thanks
>>> Joel
>>>
>>>
>>
>

Re: solr query help alpha numeric and not

Posted by Joel Nylund <jn...@yahoo.com>.
Hi yes its a string, in the case of a title, it can be anything, a  
letter a number, a symbol or a multibyte char etc.

Any ideas if I wanted a query that was not a letter a-z or a number  
0-9, given that its a string?

thanks
Joel

On Nov 4, 2009, at 9:10 AM, Jonathan Hendler wrote:

> Hi Joel,
>
> The ID is sent back as a string (instead of as an integer) in your  
> example. Could this be the cause?
>
> - Jonathan
>
> On Nov 4, 2009, at 9:08 AM, Joel Nylund wrote:
>
>> Hi, I have a field called firstLetterTitle, this field has 1 char,  
>> it can be anything, I need help with a few queries on this char:
>>
>> 1.) I want all NON ALPHA and NON numbers, so any char that is not A- 
>> Z or 0-9
>>
>> I tried:
>>
>> http://localhost:8983/solr/select?q=NOT%20firstLetterTitle:0%20TO%209%20AND%20NOT%20firstLetterTitle:A%20TO%20Z
>>
>> But I get back numeric results:
>>
>> <doc>
>> <str name="firstLetterTitle">9</str>
>> <str name="id">23946447</str>
>> </doc>
>>
>>
>> 2.) I want all only Numerics:
>>
>> http://localhost:8983/solr/select?q=firstLetterTitle:0%20TO%209
>>
>> This seems to work but just checking if its the right way.
>>
>>
>>
>> 2.) I want all only English Letters:
>>
>> http://localhost:8983/solr/select?q=firstLetterTitle:A%20TO%20Z
>>
>> This seems to work but just checking if its the right way.
>>
>>
>> thanks
>> Joel
>>
>


Re: solr query help alpha numeric and not

Posted by Jonathan Hendler <jo...@gmail.com>.
Hi Joel,

The ID is sent back as a string (instead of as an integer) in your  
example. Could this be the cause?

- Jonathan

On Nov 4, 2009, at 9:08 AM, Joel Nylund wrote:

> Hi, I have a field called firstLetterTitle, this field has 1 char,  
> it can be anything, I need help with a few queries on this char:
>
> 1.) I want all NON ALPHA and NON numbers, so any char that is not A- 
> Z or 0-9
>
> I tried:
>
> http://localhost:8983/solr/select?q=NOT%20firstLetterTitle:0%20TO%209%20AND%20NOT%20firstLetterTitle:A%20TO%20Z
>
> But I get back numeric results:
>
> <doc>
> <str name="firstLetterTitle">9</str>
> <str name="id">23946447</str>
> </doc>
>
>
> 2.) I want all only Numerics:
>
> http://localhost:8983/solr/select?q=firstLetterTitle:0%20TO%209
>
> This seems to work but just checking if its the right way.
>
>
>
> 2.) I want all only English Letters:
>
> http://localhost:8983/solr/select?q=firstLetterTitle:A%20TO%20Z
>
> This seems to work but just checking if its the right way.
>
>
> thanks
> Joel
>