lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@frameweld.com
Subject Help with highlighting
Date Tue, 22 Jun 2010 20:42:08 GMT
Hi, I need help with highlighting fields that would match a query. So far, my results only
highlight if the field is from all_text, and I would like it to use other fields. It simply
isn't the case if I just turn highlighting on. Any ideas why it only applies to all_text?
Here is my schema:

<?xml version="1.0" ?>

<schema name="Search" version="1.1">
	<types>
		<!-- Basic Solr Bundled Data Types -->
		
		<!-- Rudimentary types -->
		<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"
/>
		<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"
/>
		
		<!-- Non-sortable numeric types -->
		<fieldType name="integer" class="solr.IntField" omitNorms="true"/>

		<fieldType name="long" class="solr.LongField" omitNorms="true"/>
		<fieldType name="float" class="solr.FloatField" omitNorms="true"/>
		<fieldType name="double" class="solr.DoubleField" omitNorms="true"/>
		
		<!-- Sortable numeric types -->
		<fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
		<fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
		<fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
		<fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/>
		
		<!-- Date/Time types -->

		<fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
		
		<!-- Pseudo types -->
		<fieldType name="random" class="solr.RandomSortField" indexed="true" />
		
		<!-- Analyzing types -->
		<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
			<analyzer>
				<tokenizer class="solr.WhitespaceTokenizerFactory"/>
			</analyzer>
		</fieldType>

		
		<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
			<analyzer type="index">
				<tokenizer class="solr.WhitespaceTokenizerFactory"/>
        		<!-- <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt"
ignoreCase="true" expand="false"/> -->
				<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1"
catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
				<filter class="solr.LowerCaseFilterFactory"/>
				<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
				<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
			</analyzer>

			<analyzer type="query">
				<tokenizer class="solr.WhitespaceTokenizerFactory"/>
				<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true"
expand="true"/>
				<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1"
catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/> 
				<filter class="solr.LowerCaseFilterFactory"/>
				<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
				<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
			</analyzer>
		</fieldType>

		
		<fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" >
			<analyzer>
				<tokenizer class="solr.WhitespaceTokenizerFactory"/>
				<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true"
expand="false"/>
				<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
				<filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0"
catenateWords="1" catenateNumbers="1" catenateAll="0"/>
				<filter class="solr.LowerCaseFilterFactory"/>
				<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
				<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>

			</analyzer>
		</fieldType>
		
		<fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" >
			<analyzer>
				<tokenizer class="solr.StandardTokenizerFactory"/>
				<filter class="solr.LowerCaseFilterFactory"/>
				<filter class="solr.RemoveDuplicatesTokenFilterFactory" />
				<filter class="solr.ShingleFilterFactory" maxShingleSize="2" outputUnigrams="false"
/>
			</analyzer>

		</fieldType>
		
		<fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
			<analyzer>
				<tokenizer class="solr.KeywordTokenizerFactory"/>
				<filter class="solr.LowerCaseFilterFactory" />
				<filter class="solr.TrimFilterFactory" />
				<filter class="solr.PatternReplaceFilterFactory"
					pattern="([^a-z])" replacement="" replace="all"
				/>
      		</analyzer>
		</fieldType>

		<fieldtype name="ignored" stored="false" indexed="false" class="solr.StrField" />
		
	</types>
	
	<fields>
<!-- Entry details, will be used later as a unique field -->
		<!-- searchable things -->
		<field name="presentation_id" type="sint" indexed="true" stored="true" />
		<field name="asset_id" type="sint" indexed="true" stored="true" />
		<field name="type" type="string" indexed="true" stored="true" />
		<field name="text" type="string" indexed="true" stored="true" multiValued="true" />

		<field name="time_code" type="string" indexed="true" stored="true" />
		<field name="unique_key" type="string" indexed="true" stored="true" />
		<!-- everything -->
		
		<dynamicField name="*" type="text" indexed="true" stored="true" />

		<field name="all_text" type="text" indexed="true" stored="true" allowDups="true" multiValued="true"
/>
		<copyField source="*" dest="all_text" />
		<field name="text_dup" type="textSpell" indexed="true" stored="true" allowDups="true"
/>
		<copyField source="text" dest="text_dup" />

	</fields>
	<uniqueKey>unique_key</uniqueKey>	
	<defaultSearchField>all_text</defaultSearchField>
	
	<solrQueryParser defaultOperator="OR" />
		
</schema>



Mime
View raw message