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 richardr <ri...@yahoo.de> on 2011/06/06 18:14:28 UTC

How to get default result?

Dear list,

i got a question regarding my address search:
I am searching for address data. If there is one address field not definied
(in this case the housenumber) for the specific query (e.g. city = a, street
= b, housenumber=14), I am getting no result. For every street there exists
at least one housenumber (=0).

Is it possible to get this default value (housenumber 0) as a result, if the
user is searching for the housenumber 14, which does not exist in our model?

Thanks in advance,
Richard

--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-get-default-result-tp3030665p3030665.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to get default result?

Posted by richardr <ri...@yahoo.de>.
Tomás, thanks for answer. It was very helpful!
We are using your first option now with a workaround. :)

But initially we thought not to modify the user's request. So if the user
requests the housenumber=14, we do not want to parse the request and add an
"OR 0". If there is no housenumber=14 solr should response with the defined
default value.
Does someone know if there is a way to do this?

Thanks,
Richard




--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-get-default-result-tp3030665p3067019.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to get default result?

Posted by Tomás Fernández Löbbe <to...@gmail.com>.
Hi Richard, are you setting the value to 0 at index time when the
housenumber is not present? If you are, this would be as simple as modify
the query at the application layer to city = a, street= b, housenumber=(14
OR 0).
If you are not doing anything at index time with the not present
housenumbers, you could do something like city:a AND street:b AND
(housenumber:14 OR NOT housenumber:[* TO *]).

First option is better if you ask me. You can set the default value on your
schema. See http://wiki.apache.org/solr/SchemaXml#Fields

On Mon, Jun 6, 2011 at 1:14 PM, richardr <ri...@yahoo.de> wrote:

> Dear list,
>
> i got a question regarding my address search:
> I am searching for address data. If there is one address field not definied
> (in this case the housenumber) for the specific query (e.g. city = a,
> street
> = b, housenumber=14), I am getting no result. For every street there exists
> at least one housenumber (=0).
>
> Is it possible to get this default value (housenumber 0) as a result, if
> the
> user is searching for the housenumber 14, which does not exist in our
> model?
>
> Thanks in advance,
> Richard
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-get-default-result-tp3030665p3030665.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>