File tree 4 files changed +7
-14
lines changed
4 files changed +7
-14
lines changed Original file line number Diff line number Diff line change 1
1
# Umbraco Look (Alpha)
2
- Umbraco Examine Lucene indexer and searcher with support for text match highlighting and geospatial queries .
2
+ Extends Umbraco Examine adding support for: text match highlighting, geospatial querying and tag faceting .
3
3
4
4
[ The NuGet Package] ( https://www.nuget.org/packages/Our.Umbraco.Look ) installs a single assembly _ Our.Umbraco.Look.dll_ with dependencies on:
5
5
@@ -91,8 +91,7 @@ var lookQuery = new LookQuery()
91
91
92
92
TextQuery = new TextQuery () {
93
93
SearchText = " some text to search for" ,
94
- HighlightFragments = 2 , // highlight text containing the search term twice should be returned
95
- HighlightSeparator = " ... " , // text to inject between any search term matches
94
+ GetHighlight = true , // return highlight extract from the text field containing the search text
96
95
GetText = true // raw text field should be returned (potentially a large document)
97
96
},
98
97
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ EndProject
13
13
Project ("{2150E333-8FDC-42A3-9474-1A3956D46DE8}" ) = "build" , "build" , "{453855DC-542E-404A-9378-D53153A59C8F}"
14
14
Project Section (SolutionItems ) = preProject
15
15
..\build \Package .nuspec = ..\build \Package .nuspec
16
- ..\build \Package .xml = ..\build \Package .xml
17
16
EndProject Section
18
17
EndProject
19
18
Global
Original file line number Diff line number Diff line change @@ -13,14 +13,9 @@ public class TextQuery
13
13
public float Fuzzyness { get ; set ; } = 0 ;
14
14
15
15
/// <summary>
16
- /// The max number of fragments to show, 0 = highlighting disabled
16
+ /// When true (and SearchText provided), a hightlight extract containing the search text will be returned
17
17
/// </summary>
18
- public int HighlightFragments { get ; set ; } = 0 ;
19
-
20
- /// <summary>
21
- /// Text rendered between any highlight fragments
22
- /// </summary>
23
- public string HighlightSeparator { get ; set ; } = "..." ;
18
+ public bool GetHighlight { get ; set ; } = false ;
24
19
25
20
/// <summary>
26
21
/// Flag to indicate whether the source text field should be returned
Original file line number Diff line number Diff line change @@ -250,7 +250,7 @@ public static LookResult Query(LookQuery lookQuery)
250
250
}
251
251
252
252
// setup the getHightlight func if required
253
- if ( lookQuery . TextQuery . HighlightFragments > 0 && ! string . IsNullOrWhiteSpace ( lookQuery . TextQuery . SearchText ) )
253
+ if ( lookQuery . TextQuery != null && lookQuery . TextQuery . GetHighlight && ! string . IsNullOrWhiteSpace ( lookQuery . TextQuery . SearchText ) )
254
254
{
255
255
var queryParser = new QueryParser ( Lucene . Net . Util . Version . LUCENE_29 , LookConstants . TextField , LookService . Analyzer ) ;
256
256
@@ -268,8 +268,8 @@ public static LookResult Query(LookQuery lookQuery)
268
268
var highlight = highlighter . GetBestFragments (
269
269
tokenStream ,
270
270
x ,
271
- lookQuery . TextQuery . HighlightFragments , // max number of fragments
272
- lookQuery . TextQuery . HighlightSeparator ) ; // fragment separator
271
+ 1 , // max number of fragments
272
+ "..." ) ;
273
273
274
274
return new HtmlString ( highlight ) ;
275
275
} ;
You can’t perform that action at this time.
0 commit comments