Hi

Please look at my github repo with a template for a field type allowing exact 
match. Typical use is with disMax query parser and the “pf” param.
See https://github.com/cominvent/exactmatch

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

> 28. jan. 2016 kl. 10.52 skrev Derek Poh <d...@globalsources.com>:
> 
> Hi
> 
> First of all, sorry for the long post.
> 
> How do I implement or structured the query such that one of the search fields 
> is an exact phrase match while the rest of the search fields can be exact or 
> partial matches? Is this possible?
> 
> I have the following search fields
> - P_VeryShortDescription
> - P_ShortDescription
> - P_CatConcatKeyword
> - spp_keyword_exact
> 
> For the spp_keyword_exact field, I want to apply an exact match to it.
> 
> I have a document with the following information. If I search for 'dvd', this 
> document should not match. However if I search for 'dvd bracket', this 
> document should match.
> Right now when I search for 'dvd', it is not return, which is correct.
> I want it to be return when I search for 'dvd bracket' but it is not.
> I try enclosing it in double quotes "dvd bracket" but it is not return. Then 
> again I can't enclosed the search terms in double quotes "dvd bracket" as 
> those documents with the word 'dvd' and 'bracket' in the other fields will 
> not be match, am I right?
> 
> doc:
> <arrname="spp_keyword_exact">
> <str>TV Mounts</str>
> <str>dvd bracket</str>
> </arr>
> <strname="P_VeryShortDescription">TV Mounts</str>
> <strname="P_ShortDescription">Swivel TV Mounts, Suitable for 26-42 Inches 
> Screen</str>
> <strname="P_CatConcatKeyword">Swivel TV mounts</str>
> 
> 
> Here are the fields definition:
> 
> <field indexed="true" name="spp_keyword_exact" stored="false" 
> type="gs_keyword_exact" multiValued="true"/>
> 
>    <fieldType class="solr.TextField" name="gs_keyword_exact" 
> positionIncrementGap="100">
>      <analyzer type="index">
>        <tokenizer class="solr.KeywordTokenizerFactory"/>
>        <filter class="solr.LowerCaseFilterFactory"/>
>        <filter class="solr.EnglishMinimalStemFilterFactory" />
>      </analyzer>
>      <analyzer type="query">
>        <tokenizer class="solr.KeywordTokenizerFactory"/>
>        <filter class="solr.LowerCaseFilterFactory"/>
>        <filter class="solr.EnglishMinimalStemFilterFactory" />
>      </analyzer>
>    </fieldType>
> 
> 
> The other search fields are defined as
> 
> <fieldType name="text_general" class="solr.TextField" 
> positionIncrementGap="100">
>      <analyzer type="index">
>              <tokenizer class="solr.StandardTokenizerFactory"/>
>              <filter class="solr.LowerCaseFilterFactory"/>
>              <filter class="solr.StopFilterFactory" ignoreCase="true" 
> words="stopwords.txt" />
>              <filter class="solr.SynonymFilterFactory" 
> synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>              <filter class="solr.KStemFilterFactory"/>
>          </analyzer>
>            <analyzer type="query">
>              <tokenizer class="solr.StandardTokenizerFactory"/>
>               <filter class="solr.LowerCaseFilterFactory"/>
>              <filter class="solr.StopFilterFactory" ignoreCase="true" 
> words="stopwords.txt" />
>              <filter class="solr.SynonymFilterFactory" 
> synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>              <filter class="solr.KStemFilterFactory"/>
>          </analyzer>
>    </fieldType>
> 
> Derek
> 
> ----------------------
> CONFIDENTIALITY NOTICE 
> This e-mail (including any attachments) may contain confidential and/or 
> privileged information. If you are not the intended recipient or have 
> received this e-mail in error, please inform the sender immediately and 
> delete this e-mail (including any attachments) from your computer, and you 
> must not use, disclose to anyone else or copy this e-mail (including any 
> attachments), whether in whole or in part. 
> This e-mail and any reply to it may be monitored for security, legal, 
> regulatory compliance and/or other appropriate reasons.

Reply via email to