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 elisabeth benoit <el...@gmail.com> on 2011/09/08 11:33:10 UTC

no result with q

Hello,

I have a query

/select?&q=49&q.alt=*:*&fq=NAME_ANALYZED:decorasol AND WAY_ANALYZED:rue
charonne AND (TOWN_ANALYZED:paris OR
DEPARTMENT_ANALYZED:paris)&rows=50&fl=*,score&

returning no answer because of the q=49 parameter.

The query

/select?&q=&q.alt=*:*&fq=NAME_ANALYZED:decorasol AND WAY_ANALYZED:rue
charonne AND (TOWN_ANALYZED:paris OR
DEPARTMENT_ANALYZED:paris)&rows=50&fl=*,score&


(the only difference is "q=" instead of "q=49")

returns the answer I'm expecting

Is there a way to tell Solr to only use fq and neglect q if no answer? Or am
I doomed to send first request, realize I've got no answer and then send a
second request?

I guess so, but just checking, just in case.

Thanks,
Elisabeth

Re: no result with q

Posted by Chris Hostetter <ho...@fucit.org>.
: q=49 OR *

I don't think that query means what you think it means...

: > Is there a way to tell Solr to only use fq and neglect q if no answer? Or
: > am I doomed to send first request, realize I've got no answer and then send
: > a second request?

what do you mean by "no answer" ?

I *think* what you are saying is that you want to search for "49", but if 
no docs are found matching "49" then return "all docs" (in both cases, 
filtered by your fqs)

"q=49 OR *" isn't going to do that for you.

there is no feature that will do that for you, at best you can write a 
query that will match all docs but score docs matching "49" higher then 
all other docs.

I think what you really want is to just issue two solr requests if the 
first one returns no results.  fortunately the second "all docs" request 
will be extremeley fast because of caching.

If i've missunderstood your question, please clarify...
http://wiki.apache.org/solr/UsingMailingLists


-Hoss

Re: no result with q

Posted by elisabeth benoit <el...@gmail.com>.
ok, I guess I found how

q=49 OR *

2011/9/8 elisabeth benoit <el...@gmail.com>

>
> Hello,
>
> I have a query
>
> /select?&q=49&q.alt=*:*&fq=NAME_ANALYZED:decorasol AND WAY_ANALYZED:rue
> charonne AND (TOWN_ANALYZED:paris OR
> DEPARTMENT_ANALYZED:paris)&rows=50&fl=*,score&
>
> returning no answer because of the q=49 parameter.
>
> The query
>
> /select?&q=&q.alt=*:*&fq=NAME_ANALYZED:decorasol AND WAY_ANALYZED:rue
> charonne AND (TOWN_ANALYZED:paris OR
> DEPARTMENT_ANALYZED:paris)&rows=50&fl=*,score&
>
>
> (the only difference is "q=" instead of "q=49")
>
> returns the answer I'm expecting
>
> Is there a way to tell Solr to only use fq and neglect q if no answer? Or
> am I doomed to send first request, realize I've got no answer and then send
> a second request?
>
> I guess so, but just checking, just in case.
>
> Thanks,
> Elisabeth
>
>