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 Rakhi Khatwani <rk...@gmail.com> on 2009/10/06 11:26:27 UTC

using regular expressions in solr query

Hi,
      i have an example in which i want to use a regular expression in my
solr query:
for example: suppose i wanna search on a sample :
<str name="content">raakhi rajnish ninad goureya sheetal</str>
<str name="content">ritesh rajnish ninad goureya sheetal</str>
where my content field is of type text
when i type in
QUERY:   content:raa*
RESPONSE :   <str name="content">raakhi rajnish ninad goureya sheetal</str>
QUERY: content:"ra*"
RESPONSE: 0 results
coz of this i am facing problems with the next query:
QUERY: content: "r* rajnish"
RESPONSE: 0 results
which should ideally return both the results.
any pointers??
Regards,
Raakhi

Re: using regular expressions in solr query

Posted by Rakhi Khatwani <rk...@gmail.com>.
Hi,
   some more queries:
QUERY:   buzz:base*  => returns the desired result.
QUERY:   buzz:baseWord => returns the desired result.
QUERY:   buzz:baseWord* => returns nothing.
QUERY:   buzz:base*khatwani => returns nothing
QUERY:   buzz:base*khat* => returns nothing
finding it kinda weird... ny pointers?
Regards,
Raakhi

On Fri, Oct 9, 2009 at 3:50 PM, Rakhi Khatwani <rk...@gmail.com> wrote:

> Hi,
>     well i have a schema where i store a json string.
> consider a small example schema shown below:
> <doc>
> -
> <arr name="buzz">
> -
> <str>
> {"word":"words","baseWord":"word","pos":"noun","phrase":"following are the
> list of words","frequency":7}
> </str>
> -
> <str>
> {"word":"heroes","baseWord":"hero","pos":"noun","phrase":"have you watched
> the movie heroes?","frequency":2}
> </str>
> -
> <str>
> {"word":"khatto","baseWord":"khatwani","pos":"noun","phrase":"khatto is a
> good girl","frequency":2}
> </str>
> </arr>
> <str name="content">content </str>
> <str name="id">1</str>
> <double name="score">0.5743896923934756</double>
> -
> <arr name="topic">
> <str>topic1</str>
> <str>topic2</str>
> <str>topic3</str>
> <str>topic4</str>
> <str>topic5</str>
> </arr>
> </doc>
>
> Now i wanna run a range query  on frequency or a wild card query on
> baseword
> QUERY: buzz:baseWord:khat* => gives an exception
> QUERY: buzz:"baseWord:khat*" => gives no result
> QUERY:buzz:"frequency:[2 TO 10]" =>gives no result
> QUERY: buzz:"baseWord*khatwani" => gives the result (example above)
> QUERY:buzz:"baseWord*khat*" = > gives no results.
> ny pointers?
> Regards
> Raakhi
> On Tue, Oct 6, 2009 at 7:15 PM, Feak, Todd <To...@smss.sony.com>wrote:
>
>> Any particular reason for the double quotes in the 2nd and 3rd query
>> example, but not the 1st, or is this just an artifact of your email?
>>
>> -Todd
>>
>> -----Original Message-----
>> From: Rakhi Khatwani [mailto:rkhatwani@gmail.com]
>> Sent: Tuesday, October 06, 2009 2:26 AM
>> To: solr-user@lucene.apache.org
>> Subject: using regular expressions in solr query
>>
>> Hi,
>>      i have an example in which i want to use a regular expression in my
>> solr query:
>> for example: suppose i wanna search on a sample :
>> <str name="content">raakhi rajnish ninad goureya sheetal</str>
>> <str name="content">ritesh rajnish ninad goureya sheetal</str>
>> where my content field is of type text
>> when i type in
>> QUERY:   content:raa*
>> RESPONSE :   <str name="content">raakhi rajnish ninad goureya
>> sheetal</str>
>> QUERY: content:"ra*"
>> RESPONSE: 0 results
>> coz of this i am facing problems with the next query:
>> QUERY: content: "r* rajnish"
>> RESPONSE: 0 results
>> which should ideally return both the results.
>> any pointers??
>> Regards,
>> Raakhi
>>
>>
>

Re: using regular expressions in solr query

Posted by Rakhi Khatwani <rk...@gmail.com>.
Hi,
    well i have a schema where i store a json string.
consider a small example schema shown below:
<doc>
-
<arr name="buzz">
-
<str>
{"word":"words","baseWord":"word","pos":"noun","phrase":"following are the
list of words","frequency":7}
</str>
-
<str>
{"word":"heroes","baseWord":"hero","pos":"noun","phrase":"have you watched
the movie heroes?","frequency":2}
</str>
-
<str>
{"word":"khatto","baseWord":"khatwani","pos":"noun","phrase":"khatto is a
good girl","frequency":2}
</str>
</arr>
<str name="content">content </str>
<str name="id">1</str>
<double name="score">0.5743896923934756</double>
-
<arr name="topic">
<str>topic1</str>
<str>topic2</str>
<str>topic3</str>
<str>topic4</str>
<str>topic5</str>
</arr>
</doc>

Now i wanna run a range query  on frequency or a wild card query on baseword
QUERY: buzz:baseWord:khat* => gives an exception
QUERY: buzz:"baseWord:khat*" => gives no result
QUERY:buzz:"frequency:[2 TO 10]" =>gives no result
QUERY: buzz:"baseWord*khatwani" => gives the result (example above)
QUERY:buzz:"baseWord*khat*" = > gives no results.
ny pointers?
Regards
Raakhi
On Tue, Oct 6, 2009 at 7:15 PM, Feak, Todd <To...@smss.sony.com> wrote:

> Any particular reason for the double quotes in the 2nd and 3rd query
> example, but not the 1st, or is this just an artifact of your email?
>
> -Todd
>
> -----Original Message-----
> From: Rakhi Khatwani [mailto:rkhatwani@gmail.com]
> Sent: Tuesday, October 06, 2009 2:26 AM
> To: solr-user@lucene.apache.org
> Subject: using regular expressions in solr query
>
> Hi,
>      i have an example in which i want to use a regular expression in my
> solr query:
> for example: suppose i wanna search on a sample :
> <str name="content">raakhi rajnish ninad goureya sheetal</str>
> <str name="content">ritesh rajnish ninad goureya sheetal</str>
> where my content field is of type text
> when i type in
> QUERY:   content:raa*
> RESPONSE :   <str name="content">raakhi rajnish ninad goureya sheetal</str>
> QUERY: content:"ra*"
> RESPONSE: 0 results
> coz of this i am facing problems with the next query:
> QUERY: content: "r* rajnish"
> RESPONSE: 0 results
> which should ideally return both the results.
> any pointers??
> Regards,
> Raakhi
>
>

RE: using regular expressions in solr query

Posted by "Feak, Todd" <To...@smss.sony.com>.
Any particular reason for the double quotes in the 2nd and 3rd query example, but not the 1st, or is this just an artifact of your email?

-Todd

-----Original Message-----
From: Rakhi Khatwani [mailto:rkhatwani@gmail.com] 
Sent: Tuesday, October 06, 2009 2:26 AM
To: solr-user@lucene.apache.org
Subject: using regular expressions in solr query

Hi,
      i have an example in which i want to use a regular expression in my
solr query:
for example: suppose i wanna search on a sample :
<str name="content">raakhi rajnish ninad goureya sheetal</str>
<str name="content">ritesh rajnish ninad goureya sheetal</str>
where my content field is of type text
when i type in
QUERY:   content:raa*
RESPONSE :   <str name="content">raakhi rajnish ninad goureya sheetal</str>
QUERY: content:"ra*"
RESPONSE: 0 results
coz of this i am facing problems with the next query:
QUERY: content: "r* rajnish"
RESPONSE: 0 results
which should ideally return both the results.
any pointers??
Regards,
Raakhi