开发者

Lucene: Am I correctly parsing the strings ? Terms or Phrases?

I'm new to Lucene. If I use

description = new TermQuery(new Term("description", "my string"));

I ask Lucene to consider "my string" as unique word, right ?

I actually need to consider each word, should I use PhraseQuery instead ? Or i开发者_运维问答s it correct ?

thanks


Lucene Term Consructor says

Term: public Term(String fld,String txt)

Constructs a Term with the given field and text.

It means the field shall be description and "my string" would be content of the term.

You are just constructing a term, it doesnt say anything about the search results(Uniqueness or whatever)

If you need to consider each word,use a Booleanquery and add the required conditions there

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜