2013-10-10 9 views
7

voglio cercare i dati da solr come qui di seguitoCome cercare con data utilizzando Apache Solr

enter image description here questo è il mio due tabelle:

enter image description here

enter image description here

Così come posso fare questa ricerca data con solr ....

E dit

Iam utilizzando SolrPhpClient per questo.

Si tratta di campi dal mio schema.xml:

<fields> 
    <field name="id" type="string" indexed="true" stored="true" required="true"/> 
    <field name="event_name" type="text_general" indexed="true" stored="true"/> 
    <field name="event_category_id" type="string" indexed="true" stored="true"/> 
    <field name="cat_name" type="text_general" indexed="true" stored="true"/> 
    <field name="event_sub_category_id" type="string" indexed="true" stored="true"/> 
    <field name="sub_cat_name" type="text_general" indexed="true" stored="true"/> 
    <field name="event_location" type="text_general" indexed="true" stored="true"/> 
    <field name="org_id" type="string" indexed="false" stored="true"/> 
    <field name="org_name" type="text_general" indexed="true" stored="true"/> 
    <field name="event_city" type="text_general" indexed="true" stored="true"/> 

    <field name="multiple_tags" type="text_general" indexed="true" stored="true" multiValued="true" /> 

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

    <field name="event_twitter_url" type="text_general" indexed="false" stored="true"/> 
    <field name="event_fb_url" type="text_general" indexed="false" stored="true"/> 
    <field name="search_text" type="text_general" indexed="true" stored="false" multiValued="true" /> 
    <copyField source="event_name" dest="search_text" /> 
    <copyField source="cat_name" dest="search_text" /> 
    <copyField source="org_name" dest="search_text" /> 

    <copyField source="multiple_tags" dest="search_text" /> 

    <dynamicField name="*" type="string" multiValued="true" indexed="true" stored="true" /> 
    <field name="_version_" type="long" indexed="true" stored="true"/> 
    <field name="content" type="text_general" indexed="false" stored="true" multiValued="true"/> 
    <field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/> 
</fields> 

L'immagine seguente è l'amministratore solr con tutte le query:

enter image description here

Così quando cerco multiple_start_dates:2013-10-24T00:00:00Z in q restituisce invalid date string errore ......

+0

Le domande che richiedono il codice devono dimostrare una comprensione minima del problema da risolvere. Includi soluzioni tentate, perché non hanno funzionato e i risultati attesi. – Kermit

risposta

3

dallo schema sembra che non sia stato indicizzato d mangiato i campi dalle tabelle, una volta che i campi data indice come colonne creati e modificati, è possibile effettuare query come questi:

(created:[NOW-1MONTH TO NOW]) //for current month 

(created:[NOW-3MONTH TO NOW-1MONTH]) //created within last three months but not in current month 

e così via, fare qualche esperimento con altre unità di (+/-) operatori di tempo e , avrai le richieste desiderate.

+0

vedere le mie modifiche ..... – Kichu

+0

, ho aggiunto e indicizzato i dati, che è stato completato con successo, ma la ricerca restituisce l'errore – Kichu

+0

La query che stai facendo non è una query di intervallo, prova a inserire il valore della data di input tra virgolette. – sumit