0

私はsolrの初心者です。クエリが

http://localhost:8983/solr/collection1/select?q=book%0A&wt=json&indent=true

solrパッケージに付属しているデフォルトのコレクションで正常に動作します。新しいコレクションを作成してクエリを実行しようとしましたが、クエリは次のとおりです。

http://localhost:8983/solr/newcollection/select?q=book1&wt=json&indent=trueが機能していませんか?

このクエリを機能させる方法私のスキーマは

    <fieldType name="string" class="solr.StrField"  />
    <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" >
    </fieldType>

    <fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0"/>
    <fieldtype name="binary" class="solr.BinaryField"/>

    </types>

    <fields><field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> <field name="title" type="text_general" indexed="true" stored="true" multiValued="false"/>
   <field name="genere" type="text_general" indexed="true" stored="true"/>
   <field name="description" type="text_general" indexed="true" stored="true" multiValued="false"/>
   <field name="comments" type="text_general" indexed="true" stored="true" multiValued="true"/>
   <field name="author" type="text_general" indexed="true" stored="true" />
   <field name="publications" type="text_general" indexed="true" stored="true" multiValued="true" />

    </fields>
4

2 に答える 2

0

もう 1 つのオプションは、edismax を使用して、使用するフィールドを指定することです。たとえば、次のようなクエリを発行できます。

http://localhost:8983/solr/newcollection/select?q=book1&wt=json&indent=true&qf=説明コメント&deftype=edismax

于 2016-02-06T20:14:59.670 に答える
0

クエリでフィールドを指定せずに操作できるように、デフォルトの検索フィールドを SOLR に定義する必要があります。

solrconfig.xml に以下のように定義します。

<requestHandler name="/select" class="solr.SearchHandler">
    <lst name="defaults">
         <str name="echoParams">explicit</str>
         <int name="rows">10</int>
         <str name="df">description comments </str>
    </lst>
</requestHandler>
于 2015-08-18T19:28:26.057 に答える