lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Høydahl <jan....@cominvent.com>
Subject Re: implement exact match for one of the search fields only?
Date Thu, 28 Jan 2016 21:55:48 GMT
Depends on what exactly you try to do. I think the Github README explains in what situations
my solution excels.
Especially if you do not have control over the client application, you simply get a q=foo,
then such a 
setup will allow you to boost exact matches very easily.

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

> 28. jan. 2016 kl. 16.28 skrev Alessandro Benedetti <abenedetti@apache.org>:
> 
> Jan,
> I admit I took a brief look, but what are the benefit of using your
> strategy instead of an additional not tokenised ( keywordTokenized) copy
> field ?
> 
> Cheers
> 
> On 28 January 2016 at 15:22, Jan Høydahl <jan.asf@cominvent.com> wrote:
> 
>> 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 <dpoh@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.
>> 
>> 
> 
> 
> -- 
> --------------------------
> 
> Benedetti Alessandro
> Visiting card : http://about.me/alessandro_benedetti
> 
> "Tyger, tyger burning bright
> In the forests of the night,
> What immortal hand or eye
> Could frame thy fearful symmetry?"
> 
> William Blake - Songs of Experience -1794 England


Mime
View raw message