Greetings all,
I need to be able to search an index for Chinese characters and this should be possible using the StandarardAnalyzer, which I believe is the default?
However, I'm trying to execute the following code on get no hits:
Code:
String searchTerm = "中國";
BooleanQuery searchQuery = new BooleanQuery();
searchQuery.add(new TermQuery(new Term("address.country", searchTerm )), BooleanClause.Occur.SHOULD);
FullTextSession fullTextSession = Search.getFullTextSession( getSessionFactory().getCurrentSession() );
FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(searchQuery, Address.class );
logger.error("Query: " + fullTextQuery.getQueryString());
execute fullTextQuery.list() .. etc
The printout is "Query: +address.country:中國"
If I run that same query via Luke on the same index using the StandardAnalyzer I get the expected results. I'm at a bit of a loss so I'm wondering if anyone more experienced here can tell what I've missed?
I've also explicitly set the analyzer in the Hibernate config:
Code:
<property name="hibernateProperties">
<props>
<prop key="dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.search.default.indexBase">/home/somefilesystem/indexes</prop>
<prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>
<prop key="hibernate.search.analyzer">org.apache.lucene.analysis.standard.StandardAnalyzer</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.charSet">utf8</prop>
<prop key="hibernate.connection.characterEncoding">utf8</prop>
</props>
</property>
I'm using Hibernate Search 3.4.0