Skip to content

Commit 2482efc

Browse files
committed
use mapping char filter to split lucene-nnnn, etc., as a single token
1 parent ff8b294 commit 2482efc

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

examples/jirasearch/handle.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -851,14 +851,21 @@ def toAgo(seconds):
851851
else:
852852
return addUnit('%.1f' % (seconds/24/3600/365), 'year')
853853

854-
def renderJiraHits(w, groups, userDrillDowns):
854+
def renderJiraHits(w, text, groups, userDrillDowns):
855855

856856
now = int(time.time() + getUTCOffset())
857857

858+
lowerText = text.strip().lower().replace('-', ' ')
859+
858860
# Each group is a Jira issue; each (child) doc is a comment on that issue
859861
for group in groups:
860862
fields = group['fields']
861863
key = fields['key'].upper()
864+
865+
# hack alert! really i should index a separate text+highlight field for this...
866+
if key.lower().replace('-', ' ') == lowerText:
867+
key = '<b>%s</b>' % key
868+
862869
if fields['status'] in ('Open', 'Reopened', 'In Progress'):
863870
skey = key
864871
else:
@@ -1931,9 +1938,9 @@ def handleQuery(path, isMike, environ):
19311938
if groupBy is not None:
19321939
for group in result['groups']:
19331940
renderGroupHeader(w, group, groupDDField, hitsPerGroup)
1934-
renderJiraHits(w, group['hits'], userDrillDowns)
1941+
renderJiraHits(w, text, group['hits'], userDrillDowns)
19351942
else:
1936-
renderJiraHits(w, result['groups'], userDrillDowns)
1943+
renderJiraHits(w, text, result['groups'], userDrillDowns)
19371944

19381945
#w('</div>')
19391946
w('</table>')

examples/jirasearch/indexJira.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,12 @@ def createSchema(svr):
9797
svr.send('startIndex', {'indexName': 'jira'})
9898

9999
analyzer = {
100+
'charFilters': [{'class': 'Mapping',
101+
'mappingFileContents': '"LUCENE-" => "LUCENE"\n"lucene-" => "lucene"\n"SOLR-" => "SOLR"\n"solr-" => "solr"\n"INFRA-" => "INFRA"\n"infra-" => "infra"'}],
100102
'tokenizer': ICU_TOKENIZER_KEEP_ISSUES,
101103
'tokenFilters': ['EnglishPossessive',
102104
{'class': 'WordDelimiter',
105+
'splitOnNumerics': 0,
103106
'preserveOriginal': 1},
104107
'LowerCase',
105108
{'class': 'Synonym',
@@ -133,7 +136,7 @@ def createSchema(svr):
133136
'EnglishMinimalStem']}
134137

135138
#print('TOKENS')
136-
#prettyPrintJSON(svr.send('analyze', {'analyzer': analyzer, 'indexName': 'jira', 'text': 'AnalyzingInfixSuggester'}))
139+
#prettyPrintJSON(svr.send('analyze', {'analyzer': analyzer, 'indexName': 'jira', 'text': 'foo LUCENE-444 lucene-1123 AnalyzingInfixSuggester'}))
137140

138141
fields = {'key': {'type': 'atom',
139142
'sort': True,

examples/jirasearch/server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def main():
199199
else:
200200
port = int(sys.argv[idx+1])
201201

202-
httpd = wsgiref.simple_server.make_server('10.17.4.92', port, application)
202+
httpd = wsgiref.simple_server.make_server('10.17.4.93', port, application)
203203

204204
print('Ready on port %s' % port)
205205
httpd.serve_forever()

examples/jirasearch/static/about.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
<br>
2424
&nbsp;&nbsp;<font size=+1>This site uses <a href="http://lucene.apache.org">Apache Lucene</a>, specifically <a href="https://github.com/mikemccand/luceneserver">this thin-wrapper HTTP server over Lucene</a>, to search all Lucene, Solr and Tika Jira issues. See
2525
the <a href="http://blog.mikemccandless.com/2013/05/eating-dog-food-with-lucene.html">Eating
26-
dog food with Lucene</a> blog post for details. The source code for indexing and searching Jira issues <a href="http://github.com/mikemccand/luceneserver/tree/master/examples/jirasearch">is here</a>.</font>
26+
dog food with Lucene</a> blog post and <a href="http://blog.mikemccandless.com/2016/10/jiraseseach-20-dog-food-using-lucene-to.html">Jirasearch 2.0 dog food</a> for details. The source code for indexing and searching Jira issues <a href="http://github.com/mikemccand/luceneserver/tree/master/examples/jirasearch">is here</a>.</font>
2727
</body>
2828
</html>

0 commit comments

Comments
 (0)