You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by 안재희, , Jade, , ja...@nhn.com on 2011/12/16 09:25:18 UTC

Have Anyone Needed a Method, getAnalyzer(String fieldName) of PerFieldAnalyzerWrapper Class, So Far?

Hello~
Have anyone needed a method, getAnalyzer(String fieldName) of PerFieldAnalyzerWrapper class, so far?
A method getDefaultAnalyzer() as well. 
 
It is useful in my project.
The needs would be unusual, though. Implementing these methods is very simple.
 
Does Apache Lucene have any plan to add these methods? Please Let me know about it.

Anyway,I created a new temporary class named "PerFieldAnalyzerWrapper2", having coped and pasted the PerFieldAnalyzer codes and added two methods as I mentioned above, just like below.
 
{code}
 
/** Using the instance varialbes of Apache Lucene PerFiledAnalyzerWrapper **/
private Analyzer defaultAnalyzer;
private Map<String,Analyzer> analyzerMap = new HashMap<String,Analyzer>();
/****/
 
public Analyzer getAnalyzer(String fieldName) {
  Analyzer analyzer = getDefaultAnalyzer(); 
  if (analyzerMap.containsKey(fieldName)) {
   
   analyzer = analyzerMap.get(fieldName);       
  }
  return analyzer;
 }
 
 public Analyzer getDefaultAnalyzer() {
 
  return defaultAnalyzer;
 }
 
{code} 
 
It is very simple, but I hope I could avoid an extra code sustaining in my project source tree. 
 
Thank you.
 
Jade.
 
안재희 드림.



이 메일은 나눔글꼴로 작성되었습니다. 설치하기

 안재희  Ahn Jaehee
 웹플랫폼개발랩 / 사원
  경기도 성남시 분당구 서현동 266-1 분당퍼스트타워 13층 463-824 
Tel 031-600-3776   Fax 031-784-1800   Mobile 010-9434-8412 
Email  jaehee.ahn@nhn.com 
사람과 사람, 오늘과 내일, 네트워크와 네트워크가 연결되는 더 큰 세상, NHN이 만들어 갑니다.