문제

I am writing some code the need to include all the words in the search string, eg "Apple is red". I am currently using MultiFieldQueryParser, but the search query will be (title:"apple ? red" body:"apple ? red"). I want the query looks exactly what the string should be. "apple ? red" should become "apple is red". How to I do that?

도움이 되었습니까?

해결책

Your query looks correct. The question mark in the output indicates a position increment, it doesn't indicate an actual term in the query.

The word "is" is removed from the query and the index by StandardAnalyzer, since it is a stop word in the default stop word set. StopFilter removes those terms, but increments the position to indicate where the term was removed to enable closer matching with phrase queries.

Unless you see an issue with the results of the query, there appears to be nothing wrong with it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top