[
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-221?pag...
]
Kenneth Christensen commented on HSEARCH-221:
---------------------------------------------
"Hi, I agree this feature is much needed in Hibernate Search.
Could you provide code without copyrights? ;-)"
I forgot to remove the copyrights from the test examples - just ignore the copyrights :-)
The 'real' code don't include any copyrights.
"Why would you recommend to have factories in an entity?"
Its not a recommendation - its just a proposal :-)
"I would love to see an annotation like @Language that identifies
the language for an entity, then user should plug it's own factory,
having an interface like
"Analyzer getAnalyzer(Object languageIdentifier)"
where the Object type is whatever type the @Language methods
return.
I think that separating the factory could give you more flexibility
and enable some good performance, initializing costly resources.
Also I think you'll probably want a single language-ecoding convention
across an application, not multiple."
Yes, maybe above solution is ok !?
Please have in mind that Analyzers not is serializable and not always thread-safe, e.g.
stemmers are not thread-safe!
And the Entity instance is not known to the LuceneWorker and therefore you can't get
an Analyzer from the Entity Instance.
BTW: I have only looked at the Hibernate Search code for a short time - I'm a
Hibernate Search novice and maybe I have overlooked something :-)
Get Lucene Analyzer runtime (indexing)
--------------------------------------
Key: HSEARCH-221
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-221
Project: Hibernate Search
Issue Type: Improvement
Affects Versions: 3.0.1.GA
Reporter: Kenneth Christensen
Fix For: 3.1.0.Beta1
Attachments: AddLuceneWork.java, diff-jms.txt, diff.txt, DocumentBuilder.java,
EntityInstanceAnalyzer.java, Flyer.java, Flyer.java, Flyer.java-JMS,
hibernate-search-v2.zip, hibernate-search.zip, LuceneWorker.java, TestBean.java
I'm writing a multi-language application and I have choose to use Hibernate Search.
But it looks like Hibernate Search have some limitations in multi-language applications.
I need to use the SnowballAnalyzer and create the instance at runtime because I only know
the language at runtime.
It really looks like Hibernate Search don't support runtime created analyzers for
entity instances.
I have extended Hibernate Search to support the above issue - maybe you could include the
code in Hibernate Search or implement something similarly.
I really need this feature/improvement :-)
Please see attached files.
Flyer - Entity used in test
TestBean - SessionBean used in test
org.hibernate.search.backend.impl.lucene.LuceneWorker - Added code to support entity
instance analyzer, see performWork(AddLuceneWork work, DirectoryProvider provider) and
add(Class entity, Serializable id, Document document, DirectoryProvider provider, Analyzer
analyzer).
org.hibernate.search.backend.AddLuceneWork - Added code to support analyzer.
org.hibernate.search.engine.DocumentBuilder - Added code to support entity instance
analyzer, see addWorkToQueue(Class entityClass, T entity, Serializable id, WorkType
workType, List<LuceneWork> queue, SearchFactoryImplementor
searchFactoryImplementor).
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira