Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Resolve issue #4: Add ticket comments to searchable field. Keywords w…

…ere also added.
  • Loading branch information...
commit 83e1fd4f70a91075560dddc897662fa029316377 1 parent 650d999
@dnephin authored
View
2  plugin-src/setup.py
@@ -1,7 +1,7 @@
from setuptools import setup
PACKAGE = 'TracAdvancedSearch'
-VERSION = '0.4.2'
+VERSION = '0.5'
setup(name=PACKAGE,
version=VERSION,
View
10 plugin-src/tracadvsearch/advsearch.py
@@ -304,10 +304,10 @@ def wiki_page_renamed(self, page, old_name):
# ITicketChangeListener methods
def ticket_created(self, ticket):
- from trac.ticket.api import TicketSystem
- print TicketSystem(self.env).get_ticket_fields()
- print ticket
- print ticket.values
+ comments = [
+ change[4] for change in ticket.get_changelog()
+ if change[2] == 'comment'
+ ]
doc = {
'id': 'ticket_%s' % ticket.id,
'ticket_id': ticket.id,
@@ -315,7 +315,7 @@ def ticket_created(self, ticket):
'author': ticket['reporter'],
'ticket_version': ticket['version'],
'name': ticket['summary'],
- 'text': ticket['description'],
+ 'text': '%s %s' % (ticket['description'], ' '.join(comments)),
}
for prop in (
'type',
View
11 solr/conf/data-config.xml
@@ -45,7 +45,7 @@
id as ticket_id,
'ticket' as source,
type,
- from_unixtime(time/1000000) as time,
+ from_unixtime(t.time/1000000) as time,
from_unixtime(changetime/1000000) as changetime,
component,
severity,
@@ -58,9 +58,12 @@
status,
resolution,
summary as name,
- description as text,
- keywords
- from ticket">
+ keywords,
+ CONCAT(description, ' ', GROUP_CONCAT(newvalue SEPARATOR ' ')) as text
+ FROM ticket as t LEFT JOIN ticket_change as tc ON t.id=tc.ticket
+ WHERE tc.field='comment'
+ GROUP BY t.id
+ ">
</entity>
</document>
View
3  solr/conf/schema.xml
@@ -104,7 +104,7 @@
<field name="milestone" type="string" indexed="true" stored="false"/>
<field name="status" type="string" indexed="true" stored="false"/>
<field name="resolution" type="string" indexed="true" stored="false"/>
- <field name="keywords" type="string" indexed="true" stored="false"/>
+ <field name="keywords" type="text" indexed="true" stored="false"/>
<field name="ticket_version" type="string" indexed="true" stored="false"/>
</fields>
@@ -117,5 +117,6 @@
<copyField source="text" dest="token_text"/>
<copyField source="name" dest="token_text"/>
+ <copyField source="keywords" dest="token_text"/>
</schema>
Please sign in to comment.
Something went wrong with that request. Please try again.