A keyword query specifies terms or phrases to match against indexed content. Apache Lucene tokenizes and normalizes query text, matches tokens through an inverted index, and ranks returned documents by relevance. section 11.2
Lucene query behavior varies with the terms supplied:
- "No Violation Issued Mobile Food Vendor - 881" matches both sample documents because both contain the two query tokens. section 11.2
- "No Violation Issued BRONX" returns only the document containing both the result and city terms. section 11.2
- "Mobile Food Vendor - 881 PALMER AVE" produces a precise match for the document containing both sector and street terms. section 11.2
- Logical operators such as AND, OR, and NOT can refine which indexed documents match. section 11.2
Table 11.1 Apache Lucene inverted index
| Token |
Document 1 |
Document 2 |
|
|
+ |
|
|
|
+ |
|
|
|
+ |
|
|
|
+ |
|
|
|
+ |
|
|
|
+ |
|
|
|
+ |
+ |
|
|
||
|
|
+ |
|
|
|
+ |
|
|
|
+ |
+ |
|
|
+ |
+ |
|
|
+ |
|
|
|
+ |
The inverted-index listing maps normalized tokens such as BRONX, PALMER AVE, and NO VIOLATION ISSUED to the documents containing them. section 11.2


