|
a/Allura/allura/lib/search.py |
|
b/Allura/allura/lib/search.py |
1 |
import re
|
1 |
import re
|
2 |
import socket
|
2 |
import socket
|
3 |
from logging import getLogger
|
3 |
from logging import getLogger
|
4 |
from pprint import pformat
|
|
|
5 |
|
4 |
|
6 |
import markdown
|
5 |
import markdown
|
7 |
from pylons import tmpl_context as c, app_globals as g
|
6 |
from pylons import tmpl_context as c, app_globals as g
|
8 |
from pysolr import SolrError
|
7 |
from pysolr import SolrError
|
9 |
|
8 |
|
|
... |
|
... |
16 |
doc = obj.index()
|
15 |
doc = obj.index()
|
17 |
if doc is None: return None
|
16 |
if doc is None: return None
|
18 |
# if index() returned doc without text, assume empty text
|
17 |
# if index() returned doc without text, assume empty text
|
19 |
if not doc.get('text'):
|
18 |
if not doc.get('text'):
|
20 |
doc['text'] = ''
|
19 |
doc['text'] = ''
|
21 |
# Tracker uses search with default solr parser. It would match only on
|
|
|
22 |
# `text`, so we append all other field values into `text`, to match on it too.
|
|
|
23 |
if getattr(obj, 'type_s', '').lower() == 'ticket':
|
|
|
24 |
doc['text'] += pformat(doc.values())
|
|
|
25 |
return doc
|
20 |
return doc
|
26 |
|
21 |
|
27 |
class SearchError(SolrError):
|
22 |
class SearchError(SolrError):
|
28 |
pass
|
23 |
pass
|
29 |
|
24 |
|