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 Shivani Sawhney <sh...@netedgecomputing.com> on 2006/06/12 06:30:57 UTC
Asserting that a value must match the entire content of a field
Hi,
I have a small query here.
How do I do an exact match on the value of a field and also assert that the
value must match the entire content of that field?
For E.g., I want that only the documents with 'Product Lifecycle' as the
value of a given field must be selected and even documents with 'Product
Lifecycle Management' as the field value must not be selected.
Thanks in Advance.
Shivani
Re: Asserting that a value must match the entire content of a field
Posted by Otis Gospodnetic <ot...@yahoo.com>.
Don't tokenize the "title" field. Use Index.UN_TOKENIZED when constructing the "title" Field.
Otis
----- Original Message ----
From: Shivani Sawhney <sh...@netedgecomputing.com>
To: java-user@lucene.apache.org
Sent: Monday, June 12, 2006 3:58:24 AM
Subject: RE: Asserting that a value must match the entire content of a field
Ok...
I'll explain the problem that I am facing with an example...
I have several fields for the documents that I index; one of the fields is
'title'. Now I have provided the user with a screen to search for documents
with a particular title. Let's assume that the value inputted by the user is
'Project Lifecycle', now I want only the documents with 'Project Lifecycle'
as the 'title' field value to be selected and not the documents with title
as 'Project Lifecycle Management', etc.
I have used exact match but then exact match for 'Project Lifecycle' in the
'title' field will also allow documents with 'Project Lifecycle Management'
as the field value to be short-listed, which I want to avoid.
How do I accomplish this?
Shivani
-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
Sent: Monday, June 12, 2006 12:39 PM
To: java-user@lucene.apache.org
Subject: Re: Asserting that a value must match the entire content of a field
On Jun 12, 2006, at 2:04 AM, Shivani Sawhney wrote:
> Are you saying that there is no out-of-the-box way of doing this...?
Well, there are lots of techniques for all sorts of tricks with
Lucene. What you're basically asking for is an untokenized, indexed
field and a TermQuery to find a document with an exact match for a
field. Will that work for your situation? If not, give us some more
details of why that doesn't work and we'll work from there.
Erik
> Can I not check the content length somehow? As in, mention that the
> length
> of the value (to be matched) must match the length of the field
> value...
>
> -----Original Message-----
> From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> Sent: Monday, June 12, 2006 11:10 AM
> To: java-user@lucene.apache.org
> Subject: Re: Asserting that a value must match the entire content
> of a field
>
> One (ugly) way might be to insert artificial begin/end markers at
> both index
> and search time.
>
> Otis
>
> ----- Original Message ----
> From: Shivani Sawhney <sh...@netedgecomputing.com>
> To: java-user@lucene.apache.org
> Sent: Monday, June 12, 2006 12:30:57 AM
> Subject: Asserting that a value must match the entire content of a
> field
>
> Hi,
>
> I have a small query here.
>
>
>
> How do I do an exact match on the value of a field and also assert
> that the
> value must match the entire content of that field?
>
> For E.g., I want that only the documents with 'Product Lifecycle'
> as the
> value of a given field must be selected and even documents with
> 'Product
> Lifecycle Management' as the field value must not be selected.
>
>
>
> Thanks in Advance.
>
>
>
> Shivani
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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
---------------------------------------------------------------------
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: Asserting that a value must match the entire content of a field
Posted by Shivani Sawhney <sh...@netedgecomputing.com>.
Ok...
I'll explain the problem that I am facing with an example...
I have several fields for the documents that I index; one of the fields is
'title'. Now I have provided the user with a screen to search for documents
with a particular title. Let's assume that the value inputted by the user is
'Project Lifecycle', now I want only the documents with 'Project Lifecycle'
as the 'title' field value to be selected and not the documents with title
as 'Project Lifecycle Management', etc.
I have used exact match but then exact match for 'Project Lifecycle' in the
'title' field will also allow documents with 'Project Lifecycle Management'
as the field value to be short-listed, which I want to avoid.
How do I accomplish this?
Shivani
-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
Sent: Monday, June 12, 2006 12:39 PM
To: java-user@lucene.apache.org
Subject: Re: Asserting that a value must match the entire content of a field
On Jun 12, 2006, at 2:04 AM, Shivani Sawhney wrote:
> Are you saying that there is no out-of-the-box way of doing this...?
Well, there are lots of techniques for all sorts of tricks with
Lucene. What you're basically asking for is an untokenized, indexed
field and a TermQuery to find a document with an exact match for a
field. Will that work for your situation? If not, give us some more
details of why that doesn't work and we'll work from there.
Erik
> Can I not check the content length somehow? As in, mention that the
> length
> of the value (to be matched) must match the length of the field
> value...
>
> -----Original Message-----
> From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> Sent: Monday, June 12, 2006 11:10 AM
> To: java-user@lucene.apache.org
> Subject: Re: Asserting that a value must match the entire content
> of a field
>
> One (ugly) way might be to insert artificial begin/end markers at
> both index
> and search time.
>
> Otis
>
> ----- Original Message ----
> From: Shivani Sawhney <sh...@netedgecomputing.com>
> To: java-user@lucene.apache.org
> Sent: Monday, June 12, 2006 12:30:57 AM
> Subject: Asserting that a value must match the entire content of a
> field
>
> Hi,
>
> I have a small query here.
>
>
>
> How do I do an exact match on the value of a field and also assert
> that the
> value must match the entire content of that field?
>
> For E.g., I want that only the documents with 'Product Lifecycle'
> as the
> value of a given field must be selected and even documents with
> 'Product
> Lifecycle Management' as the field value must not be selected.
>
>
>
> Thanks in Advance.
>
>
>
> Shivani
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Asserting that a value must match the entire content of a field
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jun 12, 2006, at 2:04 AM, Shivani Sawhney wrote:
> Are you saying that there is no out-of-the-box way of doing this...?
Well, there are lots of techniques for all sorts of tricks with
Lucene. What you're basically asking for is an untokenized, indexed
field and a TermQuery to find a document with an exact match for a
field. Will that work for your situation? If not, give us some more
details of why that doesn't work and we'll work from there.
Erik
> Can I not check the content length somehow? As in, mention that the
> length
> of the value (to be matched) must match the length of the field
> value...
>
> -----Original Message-----
> From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> Sent: Monday, June 12, 2006 11:10 AM
> To: java-user@lucene.apache.org
> Subject: Re: Asserting that a value must match the entire content
> of a field
>
> One (ugly) way might be to insert artificial begin/end markers at
> both index
> and search time.
>
> Otis
>
> ----- Original Message ----
> From: Shivani Sawhney <sh...@netedgecomputing.com>
> To: java-user@lucene.apache.org
> Sent: Monday, June 12, 2006 12:30:57 AM
> Subject: Asserting that a value must match the entire content of a
> field
>
> Hi,
>
> I have a small query here.
>
>
>
> How do I do an exact match on the value of a field and also assert
> that the
> value must match the entire content of that field?
>
> For E.g., I want that only the documents with 'Product Lifecycle'
> as the
> value of a given field must be selected and even documents with
> 'Product
> Lifecycle Management' as the field value must not be selected.
>
>
>
> Thanks in Advance.
>
>
>
> Shivani
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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
RE: Asserting that a value must match the entire content of a field
Posted by Shivani Sawhney <sh...@netedgecomputing.com>.
Are you saying that there is no out-of-the-box way of doing this...?
Can I not check the content length somehow? As in, mention that the length
of the value (to be matched) must match the length of the field value...
-----Original Message-----
From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
Sent: Monday, June 12, 2006 11:10 AM
To: java-user@lucene.apache.org
Subject: Re: Asserting that a value must match the entire content of a field
One (ugly) way might be to insert artificial begin/end markers at both index
and search time.
Otis
----- Original Message ----
From: Shivani Sawhney <sh...@netedgecomputing.com>
To: java-user@lucene.apache.org
Sent: Monday, June 12, 2006 12:30:57 AM
Subject: Asserting that a value must match the entire content of a field
Hi,
I have a small query here.
How do I do an exact match on the value of a field and also assert that the
value must match the entire content of that field?
For E.g., I want that only the documents with 'Product Lifecycle' as the
value of a given field must be selected and even documents with 'Product
Lifecycle Management' as the field value must not be selected.
Thanks in Advance.
Shivani
---------------------------------------------------------------------
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: Asserting that a value must match the entire content of a field
Posted by Otis Gospodnetic <ot...@yahoo.com>.
One (ugly) way might be to insert artificial begin/end markers at both index and search time.
Otis
----- Original Message ----
From: Shivani Sawhney <sh...@netedgecomputing.com>
To: java-user@lucene.apache.org
Sent: Monday, June 12, 2006 12:30:57 AM
Subject: Asserting that a value must match the entire content of a field
Hi,
I have a small query here.
How do I do an exact match on the value of a field and also assert that the
value must match the entire content of that field?
For E.g., I want that only the documents with 'Product Lifecycle' as the
value of a given field must be selected and even documents with 'Product
Lifecycle Management' as the field value must not be selected.
Thanks in Advance.
Shivani
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org