Solr Newbie question: doubts about how to search special fields.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Solr Newbie question: doubts about how to search special fields.

Marcio Pinto Motta
Hi,

My "current" problem is to know how to make queries in special fields:

    .Date Fields
    .MultiValued Fields

Date Fields

    I have in my schema some date fields like this

    <field name="creation_date" type="date" indexed="true" stored="true"/>

    And when I add content to  this field I put in this mode:

    <field name="creation_date">2006-08-11T00:00:00Z</field>

    But when I try to serch


http://localhost:8080/solr/select/?stylesheet=&q=creation_date:2006-08-10T00:00:00Z&version=2.1&start=0&rows=10&indent=on

    I get this  error :
    org.apache.solr.core.SolrException: Invalid Date String:'2006-08-10T00'

    I think there is some special format to do queries like this :(

MultiValued Fields

    My other problem is when I try to search in a multiValued Field.

    I have in my schema this multiValued field

      <field name="cod_profile" type="string" indexed="true" stored="true"
multiValued="true"/>

    But when I try to search more than one value


http://localhost:8080/solr/select/?stylesheet=&q=cod_profile:84755+84756+84757&version=2.1&start=0&rows=10&indent=on


    I get this result <result numFound="0" start="0"/>


I read the Solr Wiki, but I didn't find examples for these situations. Could
anyone please give me some "light" :)

Thanks for attention.

BR,

Marcio
Reply | Threaded
Open this post in threaded view
|

Re: Solr Newbie question: doubts about how to search special fields.

Yonik Seeley-2
The Solr query parser extends the Lucene query parser and makes very
few syntactic changes.
http://lucene.apache.org/java/docs/queryparsersyntax.html

On 10/15/06, Marcio Pinto Motta <[hidden email]> wrote:
> creation_date:2006-08-10T00:00:00Z

':' is a special char to the lucene query parser.  The easiest way to
solve this problem is to put the value in quotes:

q=creation_date:"2006-08-10T00:00:00Z"

>cod_profile:84755 84756 84757

For this one, I assume you want any of 84755 84756 84757 in the
cod_profile field.
What it is actually doing is searching for 84756 or 84757 in the
default search field in addition to 84755 in the cod_profile field.

What you want is
 cod_profile:84755 cod_profile:84756 cod_profile:84757
or
 cod_profile:(84755 84756 84757)

-Yonik