[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-881) @Fields annotation calling getter multiple times

adam (JIRA) noreply at atlassian.com
Tue Aug 30 19:24:02 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43412#comment-43412 ] 

adam commented on HSEARCH-881:
------------------------------

If I understand correctly, then the for loop here (https://github.com/abrin/hibernate-search/blob/master/hibernate-search/src/main/java/org/hibernate/search/engine/spi/DocumentBuilderIndexedEntity.java#L480) should at minimum compare the member with the previous one in the loop (which would have been added by the @Fields processor in the AbstractDocumentBuilder (515).  I will send a pull request with the change.

BTW, the developer documentation could strongly benefit from a sample settings.xml file and a bit more documentation around this.

> @Fields annotation calling getter multiple times 
> -------------------------------------------------
>
>                 Key: HSEARCH-881
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-881
>             Project: Hibernate Search
>          Issue Type: Improvement
>          Components: engine
>    Affects Versions: 3.4.1.Final
>         Environment: hibernate 3.6.6; postgres
>            Reporter: adam
>            Priority: Minor
>             Fix For: 4.1
>
>
> placing an @Fields annotation on a method appears to cause the method's getter to be called once for each @Field annotation inside the list.  Depending on what's internal to the method, indexing speed may be optimized by setting the contents to a variable and thus only calling the method once.
> /* class snippit */
>     @Fields({ @Field(name = "allPhrase", analyzer = @Analyzer(impl = TdarStandardAnalyzer.class)),
>             @Field(name = "all", analyzer = @Analyzer(impl = LowercaseWhiteSpaceStandardAnalyzer.class)) })
>     public String getKeywords() {
>         logger.info("get keyword contents: {}",getId());
> /*  debug on save */
> INFO  2011-08-29 10:37:30,828 12676 (Resource.java:982) org.tdar.core.bean.resource.Resource  - get keyword contents: 4798
> INFO  2011-08-29 10:37:30,828 12676 (Resource.java:982) org.tdar.core.bean.resource.Resource  - get keyword contents: 4798
> ...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list