Keeping the field as string so that no analysis is done on it has yielded 
promising results.  

<field name="suggestion" type="string" stored="true" indexed="true" 
required="true" />

I will test more tomorrow and report back.

-----Original Message-----
From: Hanjan, Harinder [mailto:harinder.han...@calgary.ca] 
Sent: Wednesday, August 15, 2018 5:01 PM
To: solr-user@lucene.apache.org
Subject: [EXT] Type ahead functionality using complex phrase query parser

Hello!

I can't get Solr to give the results I would expect, would appreciate if 
someone could point me in the right direction here.

/select?q={!complexphrase}"gar*"
shows me the following terms

-        garages

-        garburator

-        gardening

-        gardens

-        garage

-        garden

-        garbage

-        century gardens

-        community gardens

I was not expecting to see the bottom two.

--- schema.xml ---
<field name="suggestion" type="text_wildcard" stored="true" indexed="true" 
required="true" /> <fieldType name="text_wildcard" class="solr.TextField" 
positionIncrementGap="100"> <analyzer type="index">
                              <tokenizer class="solr.StandardTokenizerFactory"/>
                              <filter class="solr.LowerCaseFilterFactory"/>
               </analyzer>
</fieldType>

--- query ---
/select?q={!complexphrase}"gar*"

--- solrconfig.xml ---
<requestHandler name="/select" class="solr.SearchHandler">
               <lst name="defaults">
                              <str name="echoParams">explicit</str>
                              <int name="rows">10</int>
                              <str name="df">suggestion</str>
               </lst>
</requestHandler>

Thanks!
Harinder

________________________________
NOTICE -
This communication is intended ONLY for the use of the person or entity named 
above and may contain information that is confidential or legally privileged. 
If you are not the intended recipient named above or a person responsible for 
delivering messages or communications to the intended recipient, YOU ARE HEREBY 
NOTIFIED that any use, distribution, or copying of this communication or any of 
the information contained in it is strictly prohibited. If you have received 
this communication in error, please notify us immediately by telephone and then 
destroy or delete this communication, or return it to us by mail if requested 
by us. The City of Calgary thanks you for your attention and co-operation.

Reply via email to