Domanda

Attualmente sto cercando di implementare più simile a questa funzionalità basata su una su una serie di campi in mio indice.

La mia configurazione attuale è la seguente: Haystack | PySolr | Solr

Per questo pezzo che sto utilizzando PySolr e passando i parametri alla funzione more_like_this. La risposta trova il documento, ma non tutti i risultati relativi. Perché?

Ecco l'URL mi ha colpito:

http://localhost:8080/solr/mlt?q=django_id:12123412&mlt.fl=industry_ids,loc_state,amount,sector_id&mlt.interestingTerms=details

Ecco la mia risposta da Solr:

<response>
<object type="{XXXXXX-0F1D-4F28-AAA2-XXXXXXXXXXX}" cotype="cs" id="cosymantecbfw" style="width: 0px; height: 0px; display: block;"/>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">24</int>
</lst>
<result name="match" numFound="1" start="0">
    <doc>...</doc>
</result>
<result name="response" numFound="0" start="0"/>
<lst name="interestingTerms"/>
</response>

solrconfig.xml

<!-- More Like This -->
<requestHandler name="/mlt" class="solr.MoreLikeThisHandler">
</requestHandler>

schema.xml

<field name="award_amount" type="sfloat" indexed="true" stored="true" multiValued="false" termVectors="true" />
<field name="estatus" type="slong" indexed="true" stored="true" multiValued="false" termVectors="true"/>
<field name="loc_state" type="string" indexed="true" stored="true" multiValued="false" termVectors="true"/>
<field name="orgtype_id" type="string" indexed="true" stored="true" multiValued="false" termVectors="true" />
<field name="sector_id" type="string" indexed="true" stored="true" multiValued="false" termVectors="true"/>
<field name="industry_ids" type="string" indexed="true" stored="true" multiValued="true" termVectors="true" />
<field name="award_amount_exact" type="sfloat" indexed="true" stored="true" multiValued="false" termVectors="true" />
<field name="sector_id_exact" type="string" indexed="true" stored="true" multiValued="false" termVectors="true"/>
<field name="amount_exact" type="sfloat" indexed="true" stored="true" multiValued="false" termVectors="true"/>

Qualsiasi aiuto sarebbe apprezzato!

È stato utile?

Soluzione

I tuoi campi di testo deve avere tipo text, quali processi per renderli ricercabile . I campi string sono memorizzati e interrogati come sono, quindi non sono ricercabili , che li rende inutili per MLT.

Fare riferimento campi copiare se mai desidera memorizzare gli stessi dati come sia text e string (per esempio, la sfaccettatura).


Vedo che si intende anche di trovare i numeri più vicini al nostro query. MLT non è giusto per questo. Si desidera comporre un funzione di query per questo. Solr: Altri risultati simili su campi numerici

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top