0

この リンクを参照して実装しようとすると、「BadRequest」というエラーが発生しました。理由は何でしょうか?またはそれを実装するのに役立つチュートリアルはありますか?または
solrnetのsolrサジェスタを外部ソースの場所と統合する方法は?

SolrConfig.xmlは次のとおりです。

 <searchComponent class="solr.SpellCheckComponent" name="suggest">
<lst name="spellchecker">
  <str name="name">suggest</str>
  <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
  <str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
  <!-- Alternatives to lookupImpl: 
       org.apache.solr.spelling.suggest.fst.FSTLookup   [finite state automaton]
       org.apache.solr.spelling.suggest.fst.WFSTLookupFactory [weighted finite state automaton]
       org.apache.solr.spelling.suggest.jaspell.JaspellLookup [default, jaspell-based]
       org.apache.solr.spelling.suggest.tst.TSTLookup   [ternary trees]
  -->
  <str name="field">Name</str>  <!-- the indexed field to derive suggestions from -->
  <str name="field">ManufacturerName</str>
  <str name="field">CategoryName</str>
  <str name="field">ShortDescription</str>
  <float name="threshold">0.005</float>
  <str name="buildOnCommit">true</str>
<bool name="exactMatchFirst">true</bool>
  <str name="sourceLocation">source.txt</str>

</lst>

真の提案真の5真の提案

コードは次のとおりです。

private static ISolrOperations<SolrCustomProduct> solrCustomWorker;

ISolrQueryResults<SolrCustomProduct> results;

//Check connection instance invoked or not
if (solrCustomWorker == null)
{
    Startup.Init<SolrCustomProduct>(solrURL);
    solrCustomWorker = ServiceLocator.Current.GetInstance<ISolrOperations<SolrCustomProduct>>();
}

results = solrCustomWorker.Query("ac", new QueryOptions { SpellCheck = new SpellCheckingParameters { Collate=true}, });

これがログです:

    Sep 15, 2012 10:13:59 AM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: undefined field text
    at org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1330)
    at org.apache.solr.schema.IndexSchema$SolrQueryAnalyzer.getAnalyzer(IndexSchema.java:408)
    at org.apache.solr.schema.IndexSchema$SolrIndexAnalyzer.reusableTokenStream(IndexSchema.java:383)
    at org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:574)
    at org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:206)
    at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1429)
    at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1317)
    at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1245)
    at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1234)
    at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)
    at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:79)
    at org.apache.solr.search.QParser.getQuery(QParser.java:143)
    at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:105)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:165)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:365)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:260)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1812)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Sep 15, 2012 10:13:59 AM org.apache.solr.core.SolrCore execute
INFO: [core-live] webapp=/solr path=/select params={spellcheck=true&q=ac&?=&spellcheck.collate=true&rows=100000000} status=400 QTime=1 
Sep 15, 2012 10:14:08 AM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: undefined field text
    at org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1330)
    at org.apache.solr.schema.IndexSchema$SolrQueryAnalyzer.getAnalyzer(IndexSchema.java:408)
    at org.apache.solr.schema.IndexSchema$SolrIndexAnalyzer.reusableTokenStream(IndexSchema.java:383)
    at org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:574)
    at org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:206)
    at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1429)
    at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1317)
    at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1245)
    at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1234)
    at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)
    at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:79)
    at org.apache.solr.search.QParser.getQuery(QParser.java:143)
    at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:105)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:165)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:365)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:260)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1812)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Sep 15, 2012 10:14:08 AM org.apache.solr.core.SolrCore execute
INFO: [core-live] webapp=/solr path=/select params={spellcheck=true&q=ac&?=&spellcheck.collate=true&rows=100000000} status=400 QTime=1 
Sep 15, 2012 10:14:10 AM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: undefined field text
    at org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1330)
    at org.apache.solr.schema.IndexSchema$SolrQueryAnalyzer.getAnalyzer(IndexSchema.java:408)
    at org.apache.solr.schema.IndexSchema$SolrIndexAnalyzer.reusableTokenStream(IndexSchema.java:383)
    at org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:574)
    at org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:206)
    at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1429)
    at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1317)
    at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1245)
    at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1234)
    at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)
    at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:79)
    at org.apache.solr.search.QParser.getQuery(QParser.java:143)
    at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:105)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:165)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:365)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:260)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1812)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Sep 15, 2012 10:14:10 AM org.apache.solr.core.SolrCore execute
INFO: [core-live] webapp=/solr path=/select params={spellcheck=true&q=ac&?=&spellcheck.collate=true&rows=100000000} status=400 QTime=1
4

1 に答える 1

1

構成のどこかにデフォルトの検索フィールドが定義されているtextと思います。以下に示すように、ほとんどの場合、/selectリクエストハンドラにあります。<str name="df">text</str>エントリを参照してください。

<requestHandler name="/select" class="solr.SearchHandler">
  <!-- default values for query parameters can be specified, these
       will be overridden by parameters in the request
    -->
   <lst name="defaults">
     <str name="echoParams">explicit</str>
     <int name="rows">10</int>
     <str name="df">text</str>
   </lst>

   ....
</requestHandler> 

textschema.xmlに定義された名前のフィールドがないため、このエラーが表示されるのはこのためです。ほとんどの場合、これまでにこのエラーは発生していません。b/ cは、検索するフィールドを明示的に指定しているか、別のリクエストハンドラーを使用していた可能性があります。しかし今、あなたがスペルチェッカーに対して検索しているとき、それは/selectリクエストハンドラーを使用しています。

<str name="df">text</str>エントリをスキーマの有効なデフォルトフィールドに更新するか、完全に削除して、クエリで検索するフィールドを指定します。SolrWikiのdfパラメーターの詳細。

于 2012-09-17T12:50:54.333 に答える