You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Michael Belenki <va...@belenki.name> on 2012/07/28 22:46:52 UTC

Query term completion via the suggester

Hi,

I am trying to configure the suggester for solr 3.6 as described under the
http://wiki.apache.org/solr/Suggester but the configuration does not work.
I cannot figure out what I am doing wrong...

After starting Solr-Server I am getting an exception
"org.apache.solr.common.SolrException: no field name specified in
query and no default specified via 'df' param". If I try to do a query to
get a query suggestion
"http://localhost:8983/solr/suggest?q=comp&df=autocomplete", Solr only
returns documents but no suggestions for query completion.


In the schema.xml the field is defined as following: "<field
name="autocomplete" type="textSpell" indexed="true" stored="false"
multiValued="true" />". The text spell type is: 

	<fieldType name="textSpell" class="solr.TextField"
positionIncrementGap="100" >
      <analyzer>
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt"/>
        <filter class="solr.StandardFilterFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
    </fieldType>


The request handler is defined is following:

	<requestHandler name="/suggest" class="solr.SearchHandler">
		<lst name="defaults">
			<str name="spellcheck">true</str>
			<str name="spellcheck.dictionary">a_suggest</str>
			<str name="spellcheck.onlyMorePopular">true</str>
			<str name="spellcheck.count">5</str>
			<str name="spellcheck.collate">true</str>
		</lst>
		
		<attr name="components">
			<str>suggest</str>
		</attr>
	</requestHandler>

The corresponding suggest component:

   <searchComponent name="suggest" class="solr.SpellCheckComponent">
		<lst name="spellchecker">
			<str name="name">a_suggest</str>	
			<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
			<str
name="lookupImpl">org.apache.solr.spelling.suggest.fst.FSTLookup</str>
			<str name="field">autocomplete</str>
			<str name="buildOnOptimize">true</str>
			<int name="weightBuckets">100</int>
		</lst>
   </searchComponent>

best regards,

Michael

Re: Query term completion via the suggester

Posted by Ahmet Arslan <io...@yahoo.com>.
> <attr name="components">

this should be : <arr name="components">