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 Derek Poh <dp...@globalsources.com> on 2016/01/28 10:52:26 UTC

implement exact match for one of the search fields only?

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.

Re: implement exact match for one of the search fields only?

Posted by Derek Poh <dp...@globalsources.com>.
Do you mean for the spp_keyword_exact field, I should use String field 
with keyword tokenised and lowercase token filtered?

On 1/28/2016 10:54 PM, Alessandro Benedetti wrote:
> I think you are overthinking the problem :
> I agre the described one is the most obvious solution in your case.
> Only addition is to use a keyword tokenised field type, lowercase token
> filtered if you want to be case in-sensitive .
>
> Cheers
>
> On 28 January 2016 at 13:08, Mugeesh Husain <mu...@gmail.com> wrote:
>
>> Hi,
>> if you are interested phrase query, you should use String field instead of
>> text field in schema like as
>>   <field name="Field_name" type="string" indexed="true" stored="true"/>
>>
>> this will solved you problem.
>>
>> if you are missing anything else let share
>>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/implement-exact-match-for-one-of-the-search-fields-only-tp4253786p4253827.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>
>


----------------------
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.

Re: implement exact match for one of the search fields only?

Posted by Alessandro Benedetti <ab...@apache.org>.
I think you are overthinking the problem :
I agre the described one is the most obvious solution in your case.
Only addition is to use a keyword tokenised field type, lowercase token
filtered if you want to be case in-sensitive .

Cheers

On 28 January 2016 at 13:08, Mugeesh Husain <mu...@gmail.com> wrote:

> Hi,
> if you are interested phrase query, you should use String field instead of
> text field in schema like as
>  <field name="Field_name" type="string" indexed="true" stored="true"/>
>
> this will solved you problem.
>
> if you are missing anything else let share
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/implement-exact-match-for-one-of-the-search-fields-only-tp4253786p4253827.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
--------------------------

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

Re: implement exact match for one of the search fields only?

Posted by Jack Krupansky <ja...@gmail.com>.
The desired architecture is that you use a middle app layer that clients
send queries to and that middle app layer then constructs the formal query
and sends it on to Solr proper. This architecture also enables breaking a
user query into multiple Solr queries and then aggregating the results.
Besides, the general goal is to avoid app clients talking directly to Solr
anyway.

-- Jack Krupansky

On Thu, Feb 4, 2016 at 2:57 AM, Derek Poh <dp...@globalsources.com> wrote:

> Hi Erick
>
> <<
> The manual way of doing this would be to construct an elaborate query,
> like q=spp_keyword_exact:"dvd bracket" OR P_ShortDescription:(dvd bracket)
> OR.... NOTE: the parens are necessary or the last part of the above would
> be parsed as P_ShortDescription:dvd default_searchfield:bracket
> >>
>
> Your suggestion to construct the query like q=spp_keyword_exact:"dvd
> bracket" OR P_ShortDescription:(dvd bracket) OR does not fit into our
> current implementation.
> The front-end pages will only pass the "q=search keywords" in the query to
> solr. The list of search fields (qf) is pre-defined in solr.
>
> Do you have any alternatives to implement your suggestion without making
> changes to the front-end?
>
> On 1/29/2016 1:49 AM, Erick Erickson wrote:
>
>> bq: if you are interested phrase query, you should use String field
>>
>> If you do this, you will NOT be able to search within the string. I.e.
>> if the doc field is "my dog has fleas" you cannot match
>> "dog has" with a string-based field.
>>
>> If you want to match the _entire_ string or you want prefix-only
>> matching, then string might work, i.e. if you _only_ want to be able
>> to match
>>
>> "my dog has fleas"
>> "my dog*"
>> but not
>> "dog has fleas".
>>
>> On to the root question though.
>>
>> I really think you want to look at edismax. What you're trying to do
>> is apply the same search term to individual fields. In particular,
>> the pf parameter will automatically apply the search terms _as a phrase_
>> against the field specified, relieving you of having to enclose things
>> in quotes.
>>
>> The manual way of doing this would be to construct an elaborate query,
>> like
>> q=spp_keyword_exact:"dvd bracket" OR P_ShortDescription:(dvd bracket)
>> OR....
>>
>> NOTE: the parens are necessary or the last part of the above would be
>> parsed as
>> P_ShortDescription:dvd default_searchfield:bracket
>>
>> And the &debug=query trick will show you exactly how things are actually
>> searched, it's invaluable.
>>
>> Best,
>> Erick
>>
>> On Thu, Jan 28, 2016 at 5:08 AM, Mugeesh Husain <mu...@gmail.com>
>> wrote:
>>
>>> Hi,
>>> if you are interested phrase query, you should use String field instead
>>> of
>>> text field in schema like as
>>>   <field name="Field_name" type="string" indexed="true" stored="true"/>
>>>
>>> this will solved you problem.
>>>
>>> if you are missing anything else let share
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://lucene.472066.n3.nabble.com/implement-exact-match-for-one-of-the-search-fields-only-tp4253786p4253827.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>
>>
>>
> ----------------------
> 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.
>
>

Re: implement exact match for one of the search fields only?

Posted by Derek Poh <dp...@globalsources.com>.
Hi Erick

<<
The manual way of doing this would be to construct an elaborate query, 
like q=spp_keyword_exact:"dvd bracket" OR P_ShortDescription:(dvd 
bracket) OR.... NOTE: the parens are necessary or the last part of the 
above would be parsed as P_ShortDescription:dvd default_searchfield:bracket
 >>

Your suggestion to construct the query like q=spp_keyword_exact:"dvd 
bracket" OR P_ShortDescription:(dvd bracket) OR does not fit into our 
current implementation.
The front-end pages will only pass the "q=search keywords" in the query 
to solr. The list of search fields (qf) is pre-defined in solr.

Do you have any alternatives to implement your suggestion without making 
changes to the front-end?

On 1/29/2016 1:49 AM, Erick Erickson wrote:
> bq: if you are interested phrase query, you should use String field
>
> If you do this, you will NOT be able to search within the string. I.e.
> if the doc field is "my dog has fleas" you cannot match
> "dog has" with a string-based field.
>
> If you want to match the _entire_ string or you want prefix-only
> matching, then string might work, i.e. if you _only_ want to be able
> to match
>
> "my dog has fleas"
> "my dog*"
> but not
> "dog has fleas".
>
> On to the root question though.
>
> I really think you want to look at edismax. What you're trying to do
> is apply the same search term to individual fields. In particular,
> the pf parameter will automatically apply the search terms _as a phrase_
> against the field specified, relieving you of having to enclose things
> in quotes.
>
> The manual way of doing this would be to construct an elaborate query, like
> q=spp_keyword_exact:"dvd bracket" OR P_ShortDescription:(dvd bracket) OR....
>
> NOTE: the parens are necessary or the last part of the above would be
> parsed as
> P_ShortDescription:dvd default_searchfield:bracket
>
> And the &debug=query trick will show you exactly how things are actually
> searched, it's invaluable.
>
> Best,
> Erick
>
> On Thu, Jan 28, 2016 at 5:08 AM, Mugeesh Husain <mu...@gmail.com> wrote:
>> Hi,
>> if you are interested phrase query, you should use String field instead of
>> text field in schema like as
>>   <field name="Field_name" type="string" indexed="true" stored="true"/>
>>
>> this will solved you problem.
>>
>> if you are missing anything else let share
>>
>>
>>
>> --
>> View this message in context: http://lucene.472066.n3.nabble.com/implement-exact-match-for-one-of-the-search-fields-only-tp4253786p4253827.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>

----------------------
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.


Re: implement exact match for one of the search fields only?

Posted by Jan Høydahl <ja...@cominvent.com>.
Derek, the link is not available to the public. Did you restart and re-index after changing the field type?

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

> 29. jan. 2016 kl. 04.21 skrev Derek Poh <dp...@globalsources.com>:
> 
> Hi Erick and all
> 
> Yes I am trying to apply the same search term to all the 4 search fieldsand 1 of the search field must be an exact match.
> 
> You mentioned "In particular, the pf parameter will automatically apply the search terms _as a phrase_ against the field specified, relieving you of having to enclose things in quotes."
> I triedbut it is not returning the document.
> 
> http://hkenedcdg1.globalsources.com:8983/solr/product/select?q=dvd%20bracket&qf=spp_keyword_exact&defType=edismax&debug=query&pf=spp_keyword_exact&fl=P_ProductId,spp_keyword_exact,P_SPPKW
> 
> I may have misunderstood.
> 
> 
> On 1/29/2016 1:49 AM, Erick Erickson wrote:
>> bq: if you are interested phrase query, you should use String field
>> 
>> If you do this, you will NOT be able to search within the string. I.e.
>> if the doc field is "my dog has fleas" you cannot match
>> "dog has" with a string-based field.
>> 
>> If you want to match the _entire_ string or you want prefix-only
>> matching, then string might work, i.e. if you _only_ want to be able
>> to match
>> 
>> "my dog has fleas"
>> "my dog*"
>> but not
>> "dog has fleas".
>> 
>> On to the root question though.
>> 
>> I really think you want to look at edismax. What you're trying to do
>> is apply the same search term to individual fields. In particular,
>> the pf parameter will automatically apply the search terms _as a phrase_
>> against the field specified, relieving you of having to enclose things
>> in quotes.
>> 
>> The manual way of doing this would be to construct an elaborate query, like
>> q=spp_keyword_exact:"dvd bracket" OR P_ShortDescription:(dvd bracket) OR....
>> 
>> NOTE: the parens are necessary or the last part of the above would be
>> parsed as
>> P_ShortDescription:dvd default_searchfield:bracket
>> 
>> And the &debug=query trick will show you exactly how things are actually
>> searched, it's invaluable.
>> 
>> Best,
>> Erick
>> 
>> On Thu, Jan 28, 2016 at 5:08 AM, Mugeesh Husain <mu...@gmail.com> wrote:
>>> Hi,
>>> if you are interested phrase query, you should use String field instead of
>>> text field in schema like as
>>>  <field name="Field_name" type="string" indexed="true" stored="true"/>
>>> 
>>> this will solved you problem.
>>> 
>>> if you are missing anything else let share
>>> 
>>> 
>>> 
>>> --
>>> View this message in context: http://lucene.472066.n3.nabble.com/implement-exact-match-for-one-of-the-search-fields-only-tp4253786p4253827.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>> 
> 
> 
> ----------------------
> 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.


Re: implement exact match for one of the search fields only?

Posted by Derek Poh <dp...@globalsources.com>.
Hi Erick and all

Yes I am trying to apply the same search term to all the 4 search 
fieldsand 1 of the search field must be an exact match.

You mentioned "In particular, the pf parameter will automatically apply 
the search terms _as a phrase_ against the field specified, relieving 
you of having to enclose things in quotes."
I triedbut it is not returning the document.

http://hkenedcdg1.globalsources.com:8983/solr/product/select?q=dvd%20bracket&qf=spp_keyword_exact&defType=edismax&debug=query&pf=spp_keyword_exact&fl=P_ProductId,spp_keyword_exact,P_SPPKW

I may have misunderstood.


On 1/29/2016 1:49 AM, Erick Erickson wrote:
> bq: if you are interested phrase query, you should use String field
>
> If you do this, you will NOT be able to search within the string. I.e.
> if the doc field is "my dog has fleas" you cannot match
> "dog has" with a string-based field.
>
> If you want to match the _entire_ string or you want prefix-only
> matching, then string might work, i.e. if you _only_ want to be able
> to match
>
> "my dog has fleas"
> "my dog*"
> but not
> "dog has fleas".
>
> On to the root question though.
>
> I really think you want to look at edismax. What you're trying to do
> is apply the same search term to individual fields. In particular,
> the pf parameter will automatically apply the search terms _as a phrase_
> against the field specified, relieving you of having to enclose things
> in quotes.
>
> The manual way of doing this would be to construct an elaborate query, like
> q=spp_keyword_exact:"dvd bracket" OR P_ShortDescription:(dvd bracket) OR....
>
> NOTE: the parens are necessary or the last part of the above would be
> parsed as
> P_ShortDescription:dvd default_searchfield:bracket
>
> And the &debug=query trick will show you exactly how things are actually
> searched, it's invaluable.
>
> Best,
> Erick
>
> On Thu, Jan 28, 2016 at 5:08 AM, Mugeesh Husain <mu...@gmail.com> wrote:
>> Hi,
>> if you are interested phrase query, you should use String field instead of
>> text field in schema like as
>>   <field name="Field_name" type="string" indexed="true" stored="true"/>
>>
>> this will solved you problem.
>>
>> if you are missing anything else let share
>>
>>
>>
>> --
>> View this message in context: http://lucene.472066.n3.nabble.com/implement-exact-match-for-one-of-the-search-fields-only-tp4253786p4253827.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>


----------------------
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.

Re: implement exact match for one of the search fields only?

Posted by Jack Krupansky <ja...@gmail.com>.
A simple boost query (bq) might do the trick, using edismax:

q=dvd bracket
bq=spp_keyword_exact:"dvd bracket"^100
qf=P_VeryShortDescription P_ShortDescription P_CatConcatKeyword

-- Jack Krupansky

On Thu, Jan 28, 2016 at 12:49 PM, Erick Erickson <er...@gmail.com>
wrote:

> bq: if you are interested phrase query, you should use String field
>
> If you do this, you will NOT be able to search within the string. I.e.
> if the doc field is "my dog has fleas" you cannot match
> "dog has" with a string-based field.
>
> If you want to match the _entire_ string or you want prefix-only
> matching, then string might work, i.e. if you _only_ want to be able
> to match
>
> "my dog has fleas"
> "my dog*"
> but not
> "dog has fleas".
>
> On to the root question though.
>
> I really think you want to look at edismax. What you're trying to do
> is apply the same search term to individual fields. In particular,
> the pf parameter will automatically apply the search terms _as a phrase_
> against the field specified, relieving you of having to enclose things
> in quotes.
>
> The manual way of doing this would be to construct an elaborate query, like
> q=spp_keyword_exact:"dvd bracket" OR P_ShortDescription:(dvd bracket)
> OR....
>
> NOTE: the parens are necessary or the last part of the above would be
> parsed as
> P_ShortDescription:dvd default_searchfield:bracket
>
> And the &debug=query trick will show you exactly how things are actually
> searched, it's invaluable.
>
> Best,
> Erick
>
> On Thu, Jan 28, 2016 at 5:08 AM, Mugeesh Husain <mu...@gmail.com> wrote:
> > Hi,
> > if you are interested phrase query, you should use String field instead
> of
> > text field in schema like as
> >  <field name="Field_name" type="string" indexed="true" stored="true"/>
> >
> > this will solved you problem.
> >
> > if you are missing anything else let share
> >
> >
> >
> > --
> > View this message in context:
> http://lucene.472066.n3.nabble.com/implement-exact-match-for-one-of-the-search-fields-only-tp4253786p4253827.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: implement exact match for one of the search fields only?

Posted by Erick Erickson <er...@gmail.com>.
bq: if you are interested phrase query, you should use String field

If you do this, you will NOT be able to search within the string. I.e.
if the doc field is "my dog has fleas" you cannot match
"dog has" with a string-based field.

If you want to match the _entire_ string or you want prefix-only
matching, then string might work, i.e. if you _only_ want to be able
to match

"my dog has fleas"
"my dog*"
but not
"dog has fleas".

On to the root question though.

I really think you want to look at edismax. What you're trying to do
is apply the same search term to individual fields. In particular,
the pf parameter will automatically apply the search terms _as a phrase_
against the field specified, relieving you of having to enclose things
in quotes.

The manual way of doing this would be to construct an elaborate query, like
q=spp_keyword_exact:"dvd bracket" OR P_ShortDescription:(dvd bracket) OR....

NOTE: the parens are necessary or the last part of the above would be
parsed as
P_ShortDescription:dvd default_searchfield:bracket

And the &debug=query trick will show you exactly how things are actually
searched, it's invaluable.

Best,
Erick

On Thu, Jan 28, 2016 at 5:08 AM, Mugeesh Husain <mu...@gmail.com> wrote:
> Hi,
> if you are interested phrase query, you should use String field instead of
> text field in schema like as
>  <field name="Field_name" type="string" indexed="true" stored="true"/>
>
> this will solved you problem.
>
> if you are missing anything else let share
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/implement-exact-match-for-one-of-the-search-fields-only-tp4253786p4253827.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: implement exact match for one of the search fields only?

Posted by Mugeesh Husain <mu...@gmail.com>.
Hi,
if you are interested phrase query, you should use String field instead of
text field in schema like as
 <field name="Field_name" type="string" indexed="true" stored="true"/>

this will solved you problem.

if you are missing anything else let share



--
View this message in context: http://lucene.472066.n3.nabble.com/implement-exact-match-for-one-of-the-search-fields-only-tp4253786p4253827.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: implement exact match for one of the search fields only?

Posted by Emir Arnautovic <em...@sematext.com>.
Hi Derek,
What if it does not match other fields but just exact match. From 
original question I assume it should return such results. It seems to me 
that you are AND-ing your fields and that is the reason why your query 
is not returning anything. Can you try just exact match field and see if 
it will return match.

Maybe it is best if you explain us what you want with couple of 
documents/query/result and we can give you suggestions for config and query.

Regards
Emir

-- 
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/


On 29.01.2016 02:03, Derek Poh wrote:
> Hi Emir
>
> For the other search fields, if they have matches it should be return.
>
> On 1/28/2016 8:17 PM, Emir Arnautovic wrote:
>> Hi Derek,
>> It is not clear what you are trying to achieve: "one of the search 
>> fields is an exact phrase match while the rest of the search fields 
>> can be exact or partial matches". What does "while" mean - it has to 
>> match in other fields as well or result should be scored better if it 
>> does but not mandatory to match?
>> For exact match you can use string type instead of text.
>> For querying multiple fields you can take a look at (e)dismax query 
>> parser.
>>
>> Regards,
>> Emir
>>
>
>
> ----------------------
> 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.

Re: implement exact match for one of the search fields only?

Posted by Derek Poh <dp...@globalsources.com>.
Hi Emir

For the other search fields, if they have matches it should be return.

On 1/28/2016 8:17 PM, Emir Arnautovic wrote:
> Hi Derek,
> It is not clear what you are trying to achieve: "one of the search 
> fields is an exact phrase match while the rest of the search fields 
> can be exact or partial matches". What does "while" mean - it has to 
> match in other fields as well or result should be scored better if it 
> does but not mandatory to match?
> For exact match you can use string type instead of text.
> For querying multiple fields you can take a look at (e)dismax query 
> parser.
>
> Regards,
> Emir
>


----------------------
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.

Re: implement exact match for one of the search fields only?

Posted by Emir Arnautovic <em...@sematext.com>.
Hi Derek,
It is not clear what you are trying to achieve: "one of the search 
fields is an exact phrase match while the rest of the search fields can 
be exact or partial matches". What does "while" mean - it has to match 
in other fields as well or result should be scored better if it does but 
not mandatory to match?
For exact match you can use string type instead of text.
For querying multiple fields you can take a look at (e)dismax query parser.

Regards,
Emir

-- 
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/



On 28.01.2016 10:52, Derek Poh wrote:
> 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.

Re: implement exact match for one of the search fields only?

Posted by Jan Høydahl <ja...@cominvent.com>.
> In our case we want to boost exact search ( not phrase search).
> Simply adding the copy field not tokenised  with the related boost to the
> qf list should be fine.
> Am I missing something ?

Please try it out and report back. You’ll find that the “qf” param will only ever produce matches for single tokens, split on whitespace by the query parser.

You are right that the pf solution is only good for boosting exact matches of a field which should also match partially, and Derek wants it to match phrase search but not partial search. This gets a bit trickier. You can fix it partially by rewriting the query into a normal dismax OR’ed with a phrase match on the exact field. But if you expect a sub-phrase to trigger the match, e.g. q=black dvd bracket, where black should match partially in the qfs and “dvd bracket” should match exact in the exact field, then it gets more tricky.

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

> 29. jan. 2016 kl. 15.50 skrev Alessandro Benedetti <ab...@apache.org>:
> 
> Still not following.
> Why you would like to use pf for exact search ( which is different from
> phrase search) ?
> Let's summarise :
> 
> pf
> <https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thepf(PhraseFields)Parameter>
> 
> Phrase Fields: boosts the score of documents in cases where all of the
> terms in the q parameter appear in close proximity.
> 
> pf is for very specific use cases, when you want to boost phrase searches
> in a set of fields, to boost those documents up.
> In our case we want to boost exact search ( not phrase search).
> Simply adding the copy field not tokenised  with the related boost to the
> qf list should be fine.
> Am I missing something ?
> 
> On 29 January 2016 at 10:33, Jan Høydahl <ja...@cominvent.com> wrote:
> 
>> Hi
>> 
>> Did you try? Sadly, the pf param will not apply to a non-analyzed field,
>> and is not added if query consists of one term only.
>> 
>> --
>> Jan Høydahl, search solution architect
>> Cominvent AS - www.cominvent.com
>> 
>>> 29. jan. 2016 kl. 11.14 skrev Alessandro Benedetti <
>> abenedetti@apache.org>:
>>> 
>>> Jan sorry If i insist, but I really don't see the benefit.
>>> If you use the edismax and a copy field not tokenised, you can apply the
>>> boost you want to the exact match, and the query will simply be q=foo.
>>> And you obtain exactly what you do without the markers.
>>> 
>>> But please, explain me how your solution add some benefit , because I am
>>> really curious and probably I missed some point ! :)
>>> If i misunderstood the problem, sorry about that !
>>> 
>>> Cheers
>>> 
>>> On 28 January 2016 at 21:55, Jan Høydahl <ja...@cominvent.com> wrote:
>>> 
>>>> 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 <ja...@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 <dp...@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
>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> --------------------------
>>> 
>>> 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
>> 
>> 
> 
> 
> -- 
> --------------------------
> 
> 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


Re: implement exact match for one of the search fields only?

Posted by Alessandro Benedetti <ab...@apache.org>.
Still not following.
Why you would like to use pf for exact search ( which is different from
phrase search) ?
Let's summarise :

pf
<https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thepf(PhraseFields)Parameter>

Phrase Fields: boosts the score of documents in cases where all of the
terms in the q parameter appear in close proximity.

pf is for very specific use cases, when you want to boost phrase searches
in a set of fields, to boost those documents up.
In our case we want to boost exact search ( not phrase search).
Simply adding the copy field not tokenised  with the related boost to the
qf list should be fine.
Am I missing something ?

On 29 January 2016 at 10:33, Jan Høydahl <ja...@cominvent.com> wrote:

> Hi
>
> Did you try? Sadly, the pf param will not apply to a non-analyzed field,
> and is not added if query consists of one term only.
>
> --
> Jan Høydahl, search solution architect
> Cominvent AS - www.cominvent.com
>
> > 29. jan. 2016 kl. 11.14 skrev Alessandro Benedetti <
> abenedetti@apache.org>:
> >
> > Jan sorry If i insist, but I really don't see the benefit.
> > If you use the edismax and a copy field not tokenised, you can apply the
> > boost you want to the exact match, and the query will simply be q=foo.
> > And you obtain exactly what you do without the markers.
> >
> > But please, explain me how your solution add some benefit , because I am
> > really curious and probably I missed some point ! :)
> > If i misunderstood the problem, sorry about that !
> >
> > Cheers
> >
> > On 28 January 2016 at 21:55, Jan Høydahl <ja...@cominvent.com> wrote:
> >
> >> 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 <ja...@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 <dp...@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
> >>
> >>
> >
> >
> > --
> > --------------------------
> >
> > 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
>
>


-- 
--------------------------

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

Re: implement exact match for one of the search fields only?

Posted by Jan Høydahl <ja...@cominvent.com>.
Hi

Did you try? Sadly, the pf param will not apply to a non-analyzed field, and is not added if query consists of one term only.

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

> 29. jan. 2016 kl. 11.14 skrev Alessandro Benedetti <ab...@apache.org>:
> 
> Jan sorry If i insist, but I really don't see the benefit.
> If you use the edismax and a copy field not tokenised, you can apply the
> boost you want to the exact match, and the query will simply be q=foo.
> And you obtain exactly what you do without the markers.
> 
> But please, explain me how your solution add some benefit , because I am
> really curious and probably I missed some point ! :)
> If i misunderstood the problem, sorry about that !
> 
> Cheers
> 
> On 28 January 2016 at 21:55, Jan Høydahl <ja...@cominvent.com> wrote:
> 
>> 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 <ja...@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 <dp...@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
>> 
>> 
> 
> 
> -- 
> --------------------------
> 
> 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


Re: implement exact match for one of the search fields only?

Posted by Alessandro Benedetti <ab...@apache.org>.
Jan sorry If i insist, but I really don't see the benefit.
If you use the edismax and a copy field not tokenised, you can apply the
boost you want to the exact match, and the query will simply be q=foo.
And you obtain exactly what you do without the markers.

But please, explain me how your solution add some benefit , because I am
really curious and probably I missed some point ! :)
If i misunderstood the problem, sorry about that !

Cheers

On 28 January 2016 at 21:55, Jan Høydahl <ja...@cominvent.com> wrote:

> 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 <ja...@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 <dp...@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
>
>


-- 
--------------------------

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

Re: implement exact match for one of the search fields only?

Posted by Jan Høydahl <ja...@cominvent.com>.
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 <ab...@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 <ja...@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 <dp...@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


Re: implement exact match for one of the search fields only?

Posted by Alessandro Benedetti <ab...@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 <ja...@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 <dp...@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

Re: implement exact match for one of the search fields only?

Posted by Jan Høydahl <ja...@cominvent.com>.
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 <dp...@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.