You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Fielder, Todd Patrick" <tp...@sandia.gov> on 2015/07/23 19:56:58 UTC

RE: [EXTERNAL] Re: ignore a match in a query

Unfortunately, that removes all records since all records have the term "Record type"

-----Original Message-----
From: Xiaolong Zheng [mailto:Xiaolong.Zheng@mathworks.com] 
Sent: Thursday, July 23, 2015 11:45 AM
To: 'java-user@lucene.apache.org'
Subject: [EXTERNAL] Re: ignore a match in a query

Maybe you can use the phrase search like:

	NOT "\"Record type\""


On 7/23/15, 12:53 PM, "Fielder, Todd Patrick" <tp...@sandia.gov> wrote:

>Hi,
>I'm wondering if there is a way to ignore a match in a query?  For 
>example, I have two strings
>
>1)      "Record type: record"
>
>2)      "Record type: cd"
>
>I do not want the text "record type" to match, so searching for the 
>text "record" should return string 1 and not string 2.  I can't say 
>"NOT Record Type" because then neither string would match
>
>Thanks
>
>-Todd


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: [EXTERNAL] Re: ignore a match in a query

Posted by Xiaolong Zheng <Xi...@mathworks.com>.
It sounds like this "Record type" should be filter out from search
database, or you can treat them as one token.

1st choice you can try write your own TokenFilter to peek the current word
and next word, then remove this "Record type".

2nd choice you can group this ³Record type² a single token.

The AutoPhrasingTokenFilter might fit your need:

https://github.com/LucidWorks/auto-phrase-tokenfilter/blob/master/src/main/
java/com/lucidworks/analysis/AutoPhrasingTokenFilter.java


http://lucidworks.com/blog/automatic-phrase-tokenization-improving-lucene-s
earch-precision-by-more-precise-linguistic-analysis/


Thanks,
Xiaolong


On 7/23/15, 1:56 PM, "Fielder, Todd Patrick" <tp...@sandia.gov> wrote:

>Unfortunately, that removes all records since all records have the term
>"Record type"
>
>-----Original Message-----
>From: Xiaolong Zheng [mailto:Xiaolong.Zheng@mathworks.com]
>Sent: Thursday, July 23, 2015 11:45 AM
>To: 'java-user@lucene.apache.org'
>Subject: [EXTERNAL] Re: ignore a match in a query
>
>Maybe you can use the phrase search like:
>
>	NOT "\"Record type\""
>
>
>On 7/23/15, 12:53 PM, "Fielder, Todd Patrick" <tp...@sandia.gov> wrote:
>
>>Hi,
>>I'm wondering if there is a way to ignore a match in a query?  For
>>example, I have two strings
>>
>>1)      "Record type: record"
>>
>>2)      "Record type: cd"
>>
>>I do not want the text "record type" to match, so searching for the
>>text "record" should return string 1 and not string 2.  I can't say
>>"NOT Record Type" because then neither string would match
>>
>>Thanks
>>
>>-Todd
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>For additional commands, e-mail: java-user-help@lucene.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org