[hibernate-issues] [Hibernate-JIRA] Updated: (HSEARCH-115) Add a default value for indexing null value

Hardy Ferentschik (JIRA) noreply at atlassian.com
Thu Oct 21 07:06:48 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hardy Ferentschik updated HSEARCH-115:
--------------------------------------

    Description: 
Hi,

Null elements are not indexed by lucene then it's not easy to use a nullable property in lucene query.
I have a TagTranslation entity in my model with a nullable property language. In this case null is used as default language for tag translation.
Each translation may have many variations like synonyms. 

Because I can specified a default value for null value in the @Field annotation like this @Field(index=Index.UN_TOKENIZED, store=Store.NO, default='null'), i can't search a cat tag with a default translation like this : +value:cat* +lang:null 

{code}
@Entity()
@Table(name="indexing_tag_trans")
@org.hibernate.annotations.Cache(usage=org.hibernate.annotations.CacheConcurrencyStrategy.READ_WRITE)
@Indexed
public class TagTranslation implements java.io.Serializable {
    
  
	private static final long serialVersionUID = -1065316566731456110L;
	
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @DocumentId
    private Integer id;
    
	@Field(index=Index.UN_TOKENIZED, store=Store.NO)
    private String language;
    
    @Field(index=Index.TOKENIZED, store=Store.YES)
    private String value;
    
    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    @org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
    @JoinColumn(name="translation_id")
    @IndexedEmbedded
    private List<TagVariation> variations = new LinkedList<TagVariation>();

    
    public TagTranslation() { }
...
{code}

What do you think about that ?

Ps: sorry for english write, i am a french guy.



  was:
Hi,

Null elements are not indexed by lucene then it's not easy to use a nullable property in lucene query.
I have a TagTranslation entity in my model with a nullable property language. In this case null is used as default language for tag translation.
Each translation may have many variations like synonyms. 

Because I can specified a default value for null value in the @Field annotation like this @Field(index=Index.UN_TOKENIZED, store=Store.NO, default='null'), i can't search a cat tag with a default translation like this : +value:cat* +lang:null 

<pre></code>
@Entity()
@Table(name="indexing_tag_trans")
@org.hibernate.annotations.Cache(usage=org.hibernate.annotations.CacheConcurrencyStrategy.READ_WRITE)
@Indexed
public class TagTranslation implements java.io.Serializable {
    
  
	private static final long serialVersionUID = -1065316566731456110L;
	
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @DocumentId
    private Integer id;
    
	@Field(index=Index.UN_TOKENIZED, store=Store.NO)
    private String language;
    
    @Field(index=Index.TOKENIZED, store=Store.YES)
    private String value;
    
    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    @org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
    @JoinColumn(name="translation_id")
    @IndexedEmbedded
    private List<TagVariation> variations = new LinkedList<TagVariation>();

    
    public TagTranslation() { }
...
</code>
</pre>

What do you think about that ?

Ps: sorry for english write, i am a french guy.




> Add a default value for indexing null value
> -------------------------------------------
>
>                 Key: HSEARCH-115
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-115
>             Project: Hibernate Search
>          Issue Type: Improvement
>          Components: mapping
>            Reporter: Julien Brulin
>            Assignee: Hardy Ferentschik
>             Fix For: 3.3.0
>
>
> Hi,
> Null elements are not indexed by lucene then it's not easy to use a nullable property in lucene query.
> I have a TagTranslation entity in my model with a nullable property language. In this case null is used as default language for tag translation.
> Each translation may have many variations like synonyms. 
> Because I can specified a default value for null value in the @Field annotation like this @Field(index=Index.UN_TOKENIZED, store=Store.NO, default='null'), i can't search a cat tag with a default translation like this : +value:cat* +lang:null 
> {code}
> @Entity()
> @Table(name="indexing_tag_trans")
> @org.hibernate.annotations.Cache(usage=org.hibernate.annotations.CacheConcurrencyStrategy.READ_WRITE)
> @Indexed
> public class TagTranslation implements java.io.Serializable {
>     
>   
> 	private static final long serialVersionUID = -1065316566731456110L;
> 	
>     @Id
>     @GeneratedValue(strategy=GenerationType.IDENTITY)
>     @DocumentId
>     private Integer id;
>     
> 	@Field(index=Index.UN_TOKENIZED, store=Store.NO)
>     private String language;
>     
>     @Field(index=Index.TOKENIZED, store=Store.YES)
>     private String value;
>     
>     @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
>     @org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
>     @JoinColumn(name="translation_id")
>     @IndexedEmbedded
>     private List<TagVariation> variations = new LinkedList<TagVariation>();
>     
>     public TagTranslation() { }
> ...
> {code}
> What do you think about that ?
> Ps: sorry for english write, i am a french guy.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list