我已经遵循了至少12个不同的例子,所有这些看起来基本相同。我正在使用dse5.1和solr,并尝试使用suggester。以下是我的配置(主要是示例中的香草):
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">titleSuggester</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="suggestAnalyzerFieldType">TextField</str>
<str name="field">title</str>
<str name="weightField">rating</str>
<str name="payloadField">description</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler">
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
当我尝试在本地主机上运行curl来访问它时,我得到:
message Unknown command 'suggest' in request
description Access to the specified resource has been forbidden
下面是curl命令:
curl --user myuser:mypass \
"http://localhost:8983/solr/test.movies/suggest?suggest=true&suggest.dictionary=titleSuggester&suggest.q=Po"
我一辈子都搞不懂为什么我的实现不起作用。有什么想法吗?
下面是描述配置的注解输出:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<config>
<luceneMatchVersion>LUCENE_6_0_1</luceneMatchVersion>
<dseTypeMappingVersion>2</dseTypeMappingVersion>
<directoryFactory class="solr.StandardDirectoryFactory" name="DirectoryFactory"/>
<indexConfig>
<ramBufferSizeMB>512</ramBufferSizeMB>
<rt>false</rt>
</indexConfi`enter code here`g>
<jmx/>
<updateHandler>
<autoSoftCommit>
<maxTime>10000</maxTime>
</autoSoftCommit>
</updateHandler>
<query>
<filterCache class="solr.SolrFilterCache" highWaterMarkMB="2048" lowWaterMarkMB="1024"/>
<enableLazyFieldLoading>true</enableLazyFieldLoading>
<useColdSearcher>true</useColdSearcher>
<maxWarmingSearchers>16</maxWarmingSearchers>
</query>
<requestDispatcher>
<requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000"/>
<httpCaching never304="true"/>
</requestDispatcher>
<requestHandler class="solr.SearchHandler" default="true" name="search"/>
<requestHandler class="com.datastax.bdp.search.solr.handler.component.CqlSearchHandler" name="solr_query"/>
<requestHandler class="solr.UpdateRequestHandler" name="/update"/>
<requestHandler class="solr.UpdateRequestHandler" name="/update/csv" startup="lazy"/>
<requestHandler class="solr.UpdateRequestHandler" name="/update/json" startup="lazy"/>
<requestHandler class="solr.FieldAnalysisRequestHandler" name="/analysis/field" startup="lazy"/>
<requestHandler class="solr.DocumentAnalysisRequestHandler" name="/analysis/document" startup="lazy"/>
<requestHandler class="solr.admin.AdminHandlers" name="/admin/"/>
<requestHandler class="solr.PingRequestHandler" name="/admin/ping">
<lst name="invariants">
<str name="qt">search</str>
<str name="q">solrpingquery</str>
</lst>
<lst name="defaults">
<str name="echoParams">all</str>
</lst>
</requestHandler>
<requestHandler class="solr.DumpRequestHandler" name="/debug/dump">
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="echoHandler">true</str>
</lst>
</requestHandler>
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">titleSuggester</str>
<str name="lookupImpl">FSTLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">title</str>
<str name="weightField">rating</str>
<str name="suggestAnalyzerFieldType">TextField</str>
<str name="payloadField">description</str>
<str name="buildOnStartup">true</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler">
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
</config>
下面是表中描述的输出:
CREATE TABLE test.movies (
title text PRIMARY KEY,
author text,
description text,
rating float,
release_date timestamp,
solr_query text
) WITH bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';
CREATE CUSTOM INDEX test_movies_solr_query_index ON test.movies (solr_query) USING 'com.datastax.bdp.search.solr.Cql3SolrSecondaryIndex';
describe active search index schema on test.movies;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<schema name="autoSolrSchema" version="1.5">
<types>
<fieldType class="org.apache.solr.schema.StrField" name="StrField"/>
<fieldType class="org.apache.solr.schema.TrieDateField" name="TrieDateField"/>
<fieldType class="org.apache.solr.schema.TrieFloatField" name="TrieFloatField"/>
<fieldType class="org.apache.solr.schema.TextField" name="TextField">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
</types>
<fields>
<field indexed="true" multiValued="false" name="title" stored="true" type="StrField"/>
<field docValues="true" indexed="true" multiValued="false" name="release_date" stored="true" type="TrieDateField"/>
<field docValues="true" indexed="true" multiValued="false" name="rating" stored="true" type="TrieFloatField"/>
<field indexed="true" multiValued="false" name="author" stored="true" type="TextField"/>
<field indexed="true" multiValued="false" name="description" stored="true" type="TextField"/>
</fields>
<uniqueKey>title</uniqueKey>
</schema>
1条答案
按热度按时间oug3syen1#
我无法准确地再现这个问题-当我使用
FSTLookupFactory
实现时,dse 5.1.11抛出nullpointerexception。但我让它和AnalyzingInfixLookupFactory
实现和以下配置:它是由以下cql生成的(比使用xml文件更好):
它的工作原理是: