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 Amit Sawhney <sa...@gmail.com> on 2011/08/10 11:57:10 UTC

frange not working in query

Hi All,

I am trying to sort the results on a unix timestamp using this query. 

http://url.com:8983/solr/db/select/?indent=on&version=2.1&q={!frange%20l=0.25}query($qq)&qq=nokia&sort=unix-timestamp%20desc&start=0&rows=10&qt=dismax&wt=dismax&fl=*,score&hl=on&hl.snippets=1

When I run this query, it says 'no field name specified in query and no defaultSearchField defined in schema.xml'

As soon as I remove the frange query and run this, it starts working fine. 

http://url.com:8983/solr/db/select/?indent=on&version=2.1&q=nokia&sort=unix-timestamp%20desc&start=0&rows=10&qt=dismax&wt=dismax&fl=*,score&hl=on&hl.snippets=1

Any pointers?


Thanks,
Amit

Re: frange not working in query

Posted by Amit Sawhney <am...@clickindia.com>.
The default sort is on relevance. I want to give an option to users to sort the results by date (latest on top). 
This works fine for queries which have few results (upto 100). However, it brings inaccurate results as soon as the figure reaches 1000s.
I am trying to limit the sorting to top few results only. Hoping through frange I will be able to define the lower limit of relevance score and get better results on date sort.

Is there any other way to do this?

Hope its clear.
- Amit

On 10-Aug-2011, at 7:52 PM, simon wrote:

> I meant the frange query, of course
> 
> On Wed, Aug 10, 2011 at 10:21 AM, simon <mt...@gmail.com> wrote:
>> Could you tell us what you're trying to achieve with the range query ?
>> It's not clear.
>> 
>> -Simon
>> 
>> On Wed, Aug 10, 2011 at 5:57 AM, Amit Sawhney <sa...@gmail.com> wrote:
>>> Hi All,
>>> 
>>> I am trying to sort the results on a unix timestamp using this query.
>>> 
>>> http://url.com:8983/solr/db/select/?indent=on&version=2.1&q={!frange%20l=0.25}query($qq)&qq=nokia&sort=unix-timestamp%20desc&start=0&rows=10&qt=dismax&wt=dismax&fl=*,score&hl=on&hl.snippets=1
>>> 
>>> When I run this query, it says 'no field name specified in query and no defaultSearchField defined in schema.xml'
>>> 
>>> As soon as I remove the frange query and run this, it starts working fine.
>>> 
>>> http://url.com:8983/solr/db/select/?indent=on&version=2.1&q=nokia&sort=unix-timestamp%20desc&start=0&rows=10&qt=dismax&wt=dismax&fl=*,score&hl=on&hl.snippets=1
>>> 
>>> Any pointers?
>>> 
>>> 
>>> Thanks,
>>> Amit
>> 


Re: frange not working in query

Posted by simon <mt...@gmail.com>.
I meant the frange query, of course

On Wed, Aug 10, 2011 at 10:21 AM, simon <mt...@gmail.com> wrote:
> Could you tell us what you're trying to achieve with the range query ?
> It's not clear.
>
> -Simon
>
> On Wed, Aug 10, 2011 at 5:57 AM, Amit Sawhney <sa...@gmail.com> wrote:
>> Hi All,
>>
>> I am trying to sort the results on a unix timestamp using this query.
>>
>> http://url.com:8983/solr/db/select/?indent=on&version=2.1&q={!frange%20l=0.25}query($qq)&qq=nokia&sort=unix-timestamp%20desc&start=0&rows=10&qt=dismax&wt=dismax&fl=*,score&hl=on&hl.snippets=1
>>
>> When I run this query, it says 'no field name specified in query and no defaultSearchField defined in schema.xml'
>>
>> As soon as I remove the frange query and run this, it starts working fine.
>>
>> http://url.com:8983/solr/db/select/?indent=on&version=2.1&q=nokia&sort=unix-timestamp%20desc&start=0&rows=10&qt=dismax&wt=dismax&fl=*,score&hl=on&hl.snippets=1
>>
>> Any pointers?
>>
>>
>> Thanks,
>> Amit
>

Re: frange not working in query

Posted by simon <mt...@gmail.com>.
Could you tell us what you're trying to achieve with the range query ?
It's not clear.

-Simon

On Wed, Aug 10, 2011 at 5:57 AM, Amit Sawhney <sa...@gmail.com> wrote:
> Hi All,
>
> I am trying to sort the results on a unix timestamp using this query.
>
> http://url.com:8983/solr/db/select/?indent=on&version=2.1&q={!frange%20l=0.25}query($qq)&qq=nokia&sort=unix-timestamp%20desc&start=0&rows=10&qt=dismax&wt=dismax&fl=*,score&hl=on&hl.snippets=1
>
> When I run this query, it says 'no field name specified in query and no defaultSearchField defined in schema.xml'
>
> As soon as I remove the frange query and run this, it starts working fine.
>
> http://url.com:8983/solr/db/select/?indent=on&version=2.1&q=nokia&sort=unix-timestamp%20desc&start=0&rows=10&qt=dismax&wt=dismax&fl=*,score&hl=on&hl.snippets=1
>
> Any pointers?
>
>
> Thanks,
> Amit

Re: frange not working in query

Posted by Amit Sawhney <sa...@gmail.com>.
Thanks Yonik. It solved the issue.

On 11-Aug-2011, at 6:44 PM, Yonik Seeley wrote:

> On Wed, Aug 10, 2011 at 5:57 AM, Amit Sawhney <sa...@gmail.com> wrote:
>> Hi All,
>> 
>> I am trying to sort the results on a unix timestamp using this query.
>> 
>> http://url.com:8983/solr/db/select/?indent=on&version=2.1&q={!frange%20l=0.25}query($qq)&qq=nokia&sort=unix-timestamp%20desc&start=0&rows=10&qt=dismax&wt=dismax&fl=*,score&hl=on&hl.snippets=1
>> 
>> When I run this query, it says 'no field name specified in query and no defaultSearchField defined in schema.xml'
> 
> 
> The default query type for embedded queries is "lucene".   so your
> qq=nokia is equivalent to qq={!lucene}nokia
> 
> So one way is to explicitly make it dismax:
>   qq={!dismax}nokia
> Another way is to declare the sub-query to be of type dismax:
>  q={!frange l=0.25}query({!dismax v=$qq})&qq=nokia
> 
> -Yonik
> http://www.lucidimagination.com
> 
> 
>> As soon as I remove the frange query and run this, it starts working fine.
>> 
>> http://url.com:8983/solr/db/select/?indent=on&version=2.1&q=nokia&sort=unix-timestamp%20desc&start=0&rows=10&qt=dismax&wt=dismax&fl=*,score&hl=on&hl.snippets=1
>> 
>> Any pointers?
>> 
>> 
>> Thanks,
>> Amit


Re: frange not working in query

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Wed, Aug 10, 2011 at 5:57 AM, Amit Sawhney <sa...@gmail.com> wrote:
> Hi All,
>
> I am trying to sort the results on a unix timestamp using this query.
>
> http://url.com:8983/solr/db/select/?indent=on&version=2.1&q={!frange%20l=0.25}query($qq)&qq=nokia&sort=unix-timestamp%20desc&start=0&rows=10&qt=dismax&wt=dismax&fl=*,score&hl=on&hl.snippets=1
>
> When I run this query, it says 'no field name specified in query and no defaultSearchField defined in schema.xml'


The default query type for embedded queries is "lucene".   so your
qq=nokia is equivalent to qq={!lucene}nokia

So one way is to explicitly make it dismax:
   qq={!dismax}nokia
Another way is to declare the sub-query to be of type dismax:
  q={!frange l=0.25}query({!dismax v=$qq})&qq=nokia

-Yonik
http://www.lucidimagination.com


> As soon as I remove the frange query and run this, it starts working fine.
>
> http://url.com:8983/solr/db/select/?indent=on&version=2.1&q=nokia&sort=unix-timestamp%20desc&start=0&rows=10&qt=dismax&wt=dismax&fl=*,score&hl=on&hl.snippets=1
>
> Any pointers?
>
>
> Thanks,
> Amit