Re: Exact match search
On Monday 12 July 2004 21:17, [EMAIL PROTECTED] wrote: I want to match documents that exactly equal a certain value, not just contain it. Just don't tokenize your Fields, and make sure that the query also doesn't get tokenized (the easiest way to ensure that is probably to not use QueryParser but just build a TermQuery directly from the user's input). Regards Daniel -- http://www.danielnaber.de - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Exact Match
Wilton, Reece writes: If I use an untokenized field, would fox match this as well? I need to support both exact match searches and searches where one word exists in the field. couldn't you use some start/end word (that never occurs in your texts) as anchors? That is index 'XXX brown fox YYY' instead of 'brown fox' and search for 'XXX brown fox YYY' instead of 'brown fox' for exact match? Of course the XXX and YYY would only occur in the index, not in the stored text. I don't know what the performance impact would be though. Morus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Exact Match
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Exact Match
If I use an untokenized field, would fox match this as well? I need to support both exact match searches and searches where one word exists in the field. -Original Message- From: Doug Cutting [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2003 9:44 AM To: Lucene Users List Subject: Re: Exact Match 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Exact Match
To ensure I understand... If you have: 1) A B C 2) B C 3) B C D 4) C You want B C to match #2 only But, C to match #1, #2, #3, and #4 If so, you can have a tokenized field and an untokenized one... Use the untokenized for matching 'exact' strings Use the tokenized for finding a single word in the string I.e. check B C against untokenized check C against tokenized That is, if you don't mind indexing the same data into 2 different fields. -Original Message- From: Wilton, Reece [mailto:[EMAIL PROTECTED] Sent: October 22, 2003 12:49 PM To: Lucene Users List Subject: RE: Exact Match If I use an untokenized field, would fox match this as well? I need to support both exact match searches and searches where one word exists in the field. -Original Message- From: Doug Cutting [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2003 9:44 AM To: Lucene Users List Subject: Re: Exact Match 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Exact Match
Yes, that's what I'm doing. Just wanted to see what other ideas where out there. -Original Message- From: Otis Gospodnetic [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2003 9:12 AM To: Lucene Users List Subject: Re: Exact Match 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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]