alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Lucene example source code file (SpanQuery.xml)

This example Lucene source code file (SpanQuery.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Lucene tags/keywords

exclude, include, spanfirst, spannear, spannear, spannot, spanor, spanor, spanorterms, spanorterms, spanterm, spanterm, tokens, utf-8

The Lucene SpanQuery.xml source code

<?xml version="1.0" encoding="UTF-8"?>
<SpanOr fieldName="contents">
	<SpanNear slop="8" inOrder="false" >		
			<SpanOr>
				<SpanTerm>killed
				<SpanTerm>died
				<SpanTerm>dead
			</SpanOr>
			<SpanOr>
				<!-- a less verbose way of declaring SpanTerm declarations - these are analyzed
					into a series of Tokens which are added as SpanTerm elements of a SpanOr
				-->
				<SpanOrTerms>miner miners
				<!-- finds mine near worker or workers -->
				<SpanNear slop="6" inOrder="false">		
					<SpanTerm>mine					
					<SpanOrTerms>worker workers
          <BoostingTermQuery>heavy
        </SpanNear>
			</SpanOr>
	</SpanNear>	
	<SpanFirst end="10">
		<SpanOrTerms>fire burn
	</SpanFirst> 
	<!-- Other Span examples....
		
	<SpanNot>
		<Include>
				<SpanNear slop="2" inOrder="2">		
						<SpanTerm>social
						<SpanTerm>services
				</SpanNear>				
		</Include>
		<Exclude>
				<SpanTerm>public
		</Exclude>
	</SpanNot>
		-->
</SpanOr>

Other Lucene examples (source code examples)

Here is a short list of links related to this Lucene SpanQuery.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.