4

Is it possible to find by fullTextQuery exactly word with special chars? Search by luke working good with query, but from fullTextQuery returns no results.

new BooleanClause(qBuilder.keyword().wildcard().
onField("field").matching("c++").createQuery(),BooleanClause.Occur.MUST)

Without wildcard searching for "c" without special chars.

How to solve this problem ?

kxyz
  • 802
  • 1
  • 9
  • 32
  • First off how to you index and in particular analyze the field? Provided 'c++' is indexed as is, then why don't you do a keyword() query. Under the hood this becomes a Lucene TermQuery. Also, '+' is not a special wildcard character in Lucene, so it should not cause any problems in this regards. – Hardy Jun 11 '14 at 09:57

1 Answers1

3

Using @Analyzer(impl = WhitespaceAnalyzer.class) over that field, may solve your problem.

Atul Kumar
  • 719
  • 3
  • 8
  • 29