1 5 package org.exoplatform.services.indexing; 6 7 import org.apache.lucene.analysis.Analyzer; 8 import org.apache.lucene.index.Term ; 9 import org.apache.lucene.search.* ; 10 15 public class KeywordFieldSearchInput implements SearchInput { 16 17 private String field_ ; 18 private String term_ ; 19 20 public KeywordFieldSearchInput(String field) { 21 field_ = field ; 22 } 23 24 public KeywordFieldSearchInput(String field, String term) { 25 field_ = field ; 26 term_ = term ; 27 } 28 29 public String getField() { return field_ ; } 30 31 public boolean hasTerm() { 32 return term_ != null && term_.length() > 0; 33 } 34 35 public String getTerm() { return term_ ; } 36 public void setTerm(String term) { term_ = term ; } 37 38 public Query getQuery(Analyzer analyzer) throws Exception { 39 return new TermQuery(new Term(field_, term_)) ; 40 } 41 } | Popular Tags |