You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by GitBox <gi...@apache.org> on 2021/05/22 06:10:11 UTC

[GitHub] [lucenenet] eladmarg commented on issue #487: Not sure how to avoid duplicates

eladmarg commented on issue #487:
URL: https://github.com/apache/lucenenet/issues/487#issuecomment-846357530


   Hi,
   its better to add your id field with the correct type like this:
   
   `doc.Add(new Int32Field(IdFieldName, thumb.Id, Field.Store.YES))`
   
   when you want to query by the id use this to generate the term:
   
   ```
   var bytes = new BytesRef(NumericUtils.BUF_SIZE_INT32);
   NumericUtils.Int32ToPrefixCoded(id, 0, bytes);
   var term = new Term(IdFieldName, bytes);
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org