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 "Wilton, Reece" <Re...@dig.com> on 2003/10/22 18:04:40 UTC

Exact Match

Hi,

Does Lucene support exact matching on a tokenized field?

So for example... if I add these three phrases to the index:
- "The quick brown fox"
- "The quick brown fox jumped"
- "brown fox"

I want to be able to do an exact field match so when I search for "brown
fox" I only get the last one returned.  I can do this in my own code by
storing the data and then comparing it to the search phrase.  Is that
the best way of doing this?

Thanks,
Reece



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


Re: Exact Match

Posted by Doug Cutting <cu...@lucene.com>.
Wilton, Reece wrote:
> Does Lucene support exact matching on a tokenized field?
> 
> So for example... if I add these three phrases to the index:
> - "The quick brown fox"
> - "The quick brown fox jumped"
> - "brown fox"
> 
> I want to be able to do an exact field match so when I search for "brown
> fox" I only get the last one returned.  I can do this in my own code by
> storing the data and then comparing it to the search phrase.  Is that
> the best way of doing this?

Why not just use an untokenized field?  Then just use a TermQuery, 
searching for the term "brown fox".

Doug


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


Re: Exact Match

Posted by Otis Gospodnetic <ot...@yahoo.com>.
There is no direct support for that.  However, if one of your documents
contains _only_: "brown fox", won't a search for "brown fox" give that
document the highest score, as it is the closest match, allowing you to
just pop the first hit?  It's no guarantee that the first hit is the
exact match (what if there are no exact matches in the index), but
that's a simple check to perform in your application.

Otis


--- "Wilton, Reece" <Re...@dig.com> wrote:
> Hi,
> 
> Does Lucene support exact matching on a tokenized field?
> 
> So for example... if I add these three phrases to the index:
> - "The quick brown fox"
> - "The quick brown fox jumped"
> - "brown fox"
> 
> I want to be able to do an exact field match so when I search for
> "brown
> fox" I only get the last one returned.  I can do this in my own code
> by
> storing the data and then comparing it to the search phrase.  Is that
> the best way of doing this?
> 
> Thanks,
> Reece
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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