QueryParser translates query expressions into one of Lucene’s built-in query types.
We’ll cover each query type in section 3.4; for now, take in the bigger picture provided
by table 3.2, which shows some examples of expressions and their translation.
java~. Contain terms that are close to the word java, such as lava
Table 3.2 Expression examples that QueryParser handles
Query expression
|
Matches documents that...
|
java Contain the term java in the default field
java junit , java OR junit. Contain the term java or junit, or both, in the default fielda
+java +junit , java AND junit. Contain both java and junit in the default field
title:ant. Contain the term ant in the title field
title:extreme –subject:sports , title:extreme AND NOT subject:sports.
Contain extreme in the title field and don’t have sports in the subject field(agile OR extreme) AND methodology. Contain methodology and must also contain agile and/or extreme, all in the default field
title:"junit in action". Contain the exact phrase “junit in action” in the title field
title:"junit action"~5. Contain the terms junit and action within five positions of one another, in the title fieldjava*. Contain terms that begin with java, like javaspaces, javaserver, java.net, and the exact tem java itself.
java~. Contain terms that are close to the word java, such as lava
lastmodified: [1/1/09 TO 12/31/09]. Have lastmodified field values between the dates January 1, 2009. and December 31, 2009
a. The default operator is OR. It can be set to AND (see section 3.5.6).
from lucene in action
from lucene in action
댓글 없음:
댓글 쓰기