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 jefferyyuan <yu...@gmail.com> on 2012/11/15 18:05:08 UTC

Is there a way to limit returned rows directly in a query string?

Hi, all:

Is there a way to limit returned rows directly in a query string?
I know we can limit returned size by parameter: rows, and start, but I am
wondering whether we can do this directly in query string , such as: 
q=(file_type:pdf, rows:10) OR (file_type:ppt, rows:10)
We may even add start:
q=(file_type:pdf,start:10, rows:10) OR (file_type:ppt, start:10, rows:10)

Why I am wanting this function is that, when I try to use DataImportHandler,
and want to test its performance, such as fetch 1000, 10000 rows.

Is it possible to do this in some ways using current solr?
Do you think this function is useful?



--
View this message in context: http://lucene.472066.n3.nabble.com/Is-there-a-way-to-limit-returned-rows-directly-in-a-query-string-tp4020550.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Is there a way to limit returned rows directly in a query string?

Posted by Mikhail Khludnev <mk...@griddynamics.com>.
Yun,

Literally you can call another QParser from the middle of a query and apply
local params to it via nested queries feature
http://searchhub.org/2009/03/31/nested-queries-in-solr/ syntax is little
bit tricky though.
But calling other QParser and attempting specify number of rows for it
makes absolutely no sense in Lucene universe. I guess you try to get
something like RDBMS or implement kind of imperative algorithm on top of
Solr. It doesn't seem possible to me. Everything here is around Boolean
Retrieval and Vector Space Model.

Regards


On Fri, Nov 16, 2012 at 10:16 AM, Dominique Debailleux <
dominique.debailleux@woana.net> wrote:

> First query is OK; it just doesn't fit your need if I understand
> Could you confirm that the expected result is 6 rows (3 rows w/ppt plus 3
> rows/pdf) ?
>
>
>
>
> 2012/11/15 jefferyyuan <yu...@gmail.com>
>
> > Thanks :)
> > local param is very useful, but seems it doesn't work here:
> > I tried:
> > q={!rows=3}ext_name:pdf OR ext_name:ppt  ==> this only return 3 ppt docs.
> >
> > q={!rows=3}ext_name:pdf OR q={!rows=3}ext_name:ppt
> > This causes syntax error, as solr doesn't support multiple query string.
> > q={!rows=3}ext_name:pdf OR {!rows=3}ext_name:ppt
> > This doesn't work either.
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://lucene.472066.n3.nabble.com/Is-there-a-way-to-limit-returned-rows-directly-in-a-query-string-tp4020550p4020602.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>
>
>
> --
> Dominique Debailleux
> WoAnA - small.but.robust
> [image: Accèder au profil LinkedIn de Dominique
> Debailleux]<http://www.linkedin.com/in/dominiquedebailleux>
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
 <mk...@griddynamics.com>

Re: Is there a way to limit returned rows directly in a query string?

Posted by Dominique Debailleux <do...@woana.net>.
First query is OK; it just doesn't fit your need if I understand
Could you confirm that the expected result is 6 rows (3 rows w/ppt plus 3
rows/pdf) ?




2012/11/15 jefferyyuan <yu...@gmail.com>

> Thanks :)
> local param is very useful, but seems it doesn't work here:
> I tried:
> q={!rows=3}ext_name:pdf OR ext_name:ppt  ==> this only return 3 ppt docs.
>
> q={!rows=3}ext_name:pdf OR q={!rows=3}ext_name:ppt
> This causes syntax error, as solr doesn't support multiple query string.
> q={!rows=3}ext_name:pdf OR {!rows=3}ext_name:ppt
> This doesn't work either.
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Is-there-a-way-to-limit-returned-rows-directly-in-a-query-string-tp4020550p4020602.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Dominique Debailleux
WoAnA - small.but.robust
[image: Accèder au profil LinkedIn de Dominique
Debailleux]<http://www.linkedin.com/in/dominiquedebailleux>

Re: Is there a way to limit returned rows directly in a query string?

Posted by jefferyyuan <yu...@gmail.com>.
Thanks :)
local param is very useful, but seems it doesn't work here:
I tried:
q={!rows=3}ext_name:pdf OR ext_name:ppt  ==> this only return 3 ppt docs.

q={!rows=3}ext_name:pdf OR q={!rows=3}ext_name:ppt
This causes syntax error, as solr doesn't support multiple query string.
q={!rows=3}ext_name:pdf OR {!rows=3}ext_name:ppt
This doesn't work either.




--
View this message in context: http://lucene.472066.n3.nabble.com/Is-there-a-way-to-limit-returned-rows-directly-in-a-query-string-tp4020550p4020602.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Is there a way to limit returned rows directly in a query string?

Posted by Dominique Debailleux <do...@woana.net>.
Wasn't obvious ;).

Maybe you could try local params...something like
q={!q.op=OR%20rows=3}yourQueryHere

Hope this helps

Dom


2012/11/15 jefferyyuan <yu...@gmail.com>

> Thanks for the reply.
>
> I am using SolrEntityProcessor to import data from another remote solr
> server - not database, so the query here is a solr query.
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Is-there-a-way-to-limit-returned-rows-directly-in-a-query-string-tp4020550p4020565.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Dominique Debailleux
WoAnA - small.but.robust
[image: Accèder au profil LinkedIn de Dominique
Debailleux]<http://www.linkedin.com/in/dominiquedebailleux>

Re: Is there a way to limit returned rows directly in a query string?

Posted by jefferyyuan <yu...@gmail.com>.
Thanks for the reply.

I am using SolrEntityProcessor to import data from another remote solr
server - not database, so the query here is a solr query.




--
View this message in context: http://lucene.472066.n3.nabble.com/Is-there-a-way-to-limit-returned-rows-directly-in-a-query-string-tp4020550p4020565.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Is there a way to limit returned rows directly in a query string?

Posted by Dominique Debailleux <do...@woana.net>.
Hi yun

Not sure to understand your need...
There is no relationship between a query string and DIH.
What you want to achieve (if "fetch 10000 rows" means "select 10000 rows
from a table") can be done by limiting the number of rows you SQL select
will return (the syntax differs from SGBD to SGBD).

Dom


2012/11/15 jefferyyuan <yu...@gmail.com>

> Hi, all:
>
> Is there a way to limit returned rows directly in a query string?
> I know we can limit returned size by parameter: rows, and start, but I am
> wondering whether we can do this directly in query string , such as:
> q=(file_type:pdf, rows:10) OR (file_type:ppt, rows:10)
> We may even add start:
> q=(file_type:pdf,start:10, rows:10) OR (file_type:ppt, start:10, rows:10)
>
> Why I am wanting this function is that, when I try to use
> DataImportHandler,
> and want to test its performance, such as fetch 1000, 10000 rows.
>
> Is it possible to do this in some ways using current solr?
> Do you think this function is useful?
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Is-there-a-way-to-limit-returned-rows-directly-in-a-query-string-tp4020550.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Dominique Debailleux
WoAnA - small.but.robust
[image: Accèder au profil LinkedIn de Dominique
Debailleux]<http://www.linkedin.com/in/dominiquedebailleux>