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 Thanh Ha <ja...@gmail.com> on 2011/11/11 05:37:46 UTC
Modify Field.Index.NO to Field.Index.NOT_ANALYZED
I indexed my document using Field.Index.NO as the field index type, so
now I cannot search it to make updates.
Here's how the document was added:
Document doc = new Document();
doc.add(new Field("content_id", "1234", Field.Store.YES,
Field.Index.NO, Field.TermVector.NO));
The content_id is the primary key for my documents.
Using updateDocument(Term,doc) won't work because the field must be
indexed in order to match (?).
Since I did store the value, is it possible to update this field index
type to Field.Index.NOT_ANALYZED ?
It will be very difficult to reindex, so any feedback is appreciated.
Thanks,
Tommy
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Modify Field.Index.NO to Field.Index.NOT_ANALYZED
Posted by Thanh Ha <ja...@gmail.com>.
Thanks Peter & Eric
Agreed, this is a costly mistake, and hopefully others will not make
this same mistake in the future.
I will have to reindex as some of my fields are not stored.
Regards
Tommy
On Fri, Nov 11, 2011 at 5:37 AM, Erick Erickson <er...@gmail.com> wrote:
> In addition to Peter's comment, changing future documents to
> Field.index.NOT_ANALYZED won't affect your current documents.
>
> If (and only if) you stored all your data, you could conceivably
> read through your entire index and re-index into another
> location and have your PK available. *BUT* the only data you
> have available to put in your new documents is in fields for
> which Field.Store.YES was specified, fields that were
> indexed-only don't have any way to recover the original
> data that isn't lossy.
>
> Best
> Erick
>
> On Fri, Nov 11, 2011 at 12:38 AM, ppp c <pe...@gmail.com> wrote:
>> terrible.
>>
>> you have made a big mistake, since you in fact made the primary key
>> unsearchable.
>> There is no any other method, since deleteDocument, updateDocument both
>> need Term to be searchable.
>> The only way is during the traversal of all the docs and finding the
>> matched field and delete it.
>>
>> On Fri, Nov 11, 2011 at 12:37 PM, Thanh Ha <ja...@gmail.com> wrote:
>>
>>> I indexed my document using Field.Index.NO as the field index type, so
>>> now I cannot search it to make updates.
>>> Here's how the document was added:
>>>
>>> Document doc = new Document();
>>> doc.add(new Field("content_id", "1234", Field.Store.YES,
>>> Field.Index.NO, Field.TermVector.NO));
>>>
>>> The content_id is the primary key for my documents.
>>> Using updateDocument(Term,doc) won't work because the field must be
>>> indexed in order to match (?).
>>>
>>>
>>> Since I did store the value, is it possible to update this field index
>>> type to Field.Index.NOT_ANALYZED ?
>>>
>>>
>>> It will be very difficult to reindex, so any feedback is appreciated.
>>>
>>>
>>> Thanks,
>>> Tommy
>>>
>>> ---------------------------------------------------------------------
>>> 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: Modify Field.Index.NO to Field.Index.NOT_ANALYZED
Posted by Erick Erickson <er...@gmail.com>.
In addition to Peter's comment, changing future documents to
Field.index.NOT_ANALYZED won't affect your current documents.
If (and only if) you stored all your data, you could conceivably
read through your entire index and re-index into another
location and have your PK available. *BUT* the only data you
have available to put in your new documents is in fields for
which Field.Store.YES was specified, fields that were
indexed-only don't have any way to recover the original
data that isn't lossy.
Best
Erick
On Fri, Nov 11, 2011 at 12:38 AM, ppp c <pe...@gmail.com> wrote:
> terrible.
>
> you have made a big mistake, since you in fact made the primary key
> unsearchable.
> There is no any other method, since deleteDocument, updateDocument both
> need Term to be searchable.
> The only way is during the traversal of all the docs and finding the
> matched field and delete it.
>
> On Fri, Nov 11, 2011 at 12:37 PM, Thanh Ha <ja...@gmail.com> wrote:
>
>> I indexed my document using Field.Index.NO as the field index type, so
>> now I cannot search it to make updates.
>> Here's how the document was added:
>>
>> Document doc = new Document();
>> doc.add(new Field("content_id", "1234", Field.Store.YES,
>> Field.Index.NO, Field.TermVector.NO));
>>
>> The content_id is the primary key for my documents.
>> Using updateDocument(Term,doc) won't work because the field must be
>> indexed in order to match (?).
>>
>>
>> Since I did store the value, is it possible to update this field index
>> type to Field.Index.NOT_ANALYZED ?
>>
>>
>> It will be very difficult to reindex, so any feedback is appreciated.
>>
>>
>> Thanks,
>> Tommy
>>
>> ---------------------------------------------------------------------
>> 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: Modify Field.Index.NO to Field.Index.NOT_ANALYZED
Posted by ppp c <pe...@gmail.com>.
terrible.
you have made a big mistake, since you in fact made the primary key
unsearchable.
There is no any other method, since deleteDocument, updateDocument both
need Term to be searchable.
The only way is during the traversal of all the docs and finding the
matched field and delete it.
On Fri, Nov 11, 2011 at 12:37 PM, Thanh Ha <ja...@gmail.com> wrote:
> I indexed my document using Field.Index.NO as the field index type, so
> now I cannot search it to make updates.
> Here's how the document was added:
>
> Document doc = new Document();
> doc.add(new Field("content_id", "1234", Field.Store.YES,
> Field.Index.NO, Field.TermVector.NO));
>
> The content_id is the primary key for my documents.
> Using updateDocument(Term,doc) won't work because the field must be
> indexed in order to match (?).
>
>
> Since I did store the value, is it possible to update this field index
> type to Field.Index.NOT_ANALYZED ?
>
>
> It will be very difficult to reindex, so any feedback is appreciated.
>
>
> Thanks,
> Tommy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>