You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/05/13 18:24:08 UTC

[1/6] git commit: [#3876] Add fields to ticket solr index

Updated Branches:
  refs/heads/master 16ea2661b -> f89c9c10a


[#3876] Add fields to ticket solr index

Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ddfb987f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ddfb987f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ddfb987f

Branch: refs/heads/master
Commit: ddfb987f28b9faab79556b8a97124896cd27b5da
Parents: 8f9ce73
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue May 7 17:02:19 2013 -0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri May 10 21:39:39 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py          |    2 ++
 ForgeTracker/forgetracker/widgets/ticket_search.py |    8 ++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ddfb987f/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 591495f..45bef8b 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -358,12 +358,14 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
             title='Ticket %s' % self.ticket_num,
             version_i=self.version,
             type_s=self.type_s,
+            created_date_dt=self.created_date,
             ticket_num_i=self.ticket_num,
             summary_t=self.summary,
             milestone_s=self.milestone,
             status_s=self.status,
             text=self.description,
             snippet_s=self.summary,
+            private_b=self.private,
             votes_up_i=self.votes_up,
             votes_down_i=self.votes_down,
             votes_total_i=(self.votes_up - self.votes_down),

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ddfb987f/ForgeTracker/forgetracker/widgets/ticket_search.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_search.py b/ForgeTracker/forgetracker/widgets/ticket_search.py
index 6e97813..38a91a7 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_search.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_search.py
@@ -96,16 +96,19 @@ class SearchHelp(ffw.Lightbox):
 <li>Labels assigned to the ticket - labels</li>
 <li>Milestone the ticket is assigned to - _milestone</li>
 <li>Last modified date - mod_date</li>
+<li>Created date - created_date</li>
 <li>Body of the ticket - text</li>
 <li>Number of ticket - ticket_num</li>
 <li>User who created the ticket - reported_by</li>
 <li>Status of the ticket - status</li>
 <li>Title of the ticket - summary</li>
+<li>Private ticket - private</li>
 <li>Votes up/down of the ticket - votes_up/votes_down (if enabled in tool options)</li>
 <li>Votes total of the ticket - votes_total</li>
 <li>Imported legacy id - import_id</li>
 <li>Custom field - the field name with an underscore in front, like _custom</li>
 </ul>
+
 <h2>Example searches</h2>
 <p>Any ticket that is not closed in the 1.0 milestone with "foo" in the title</p>
 <div class="codehilite"><pre>!status:closed AND summary:foo* AND _milestone:1.0</pre></div>
@@ -117,6 +120,9 @@ class SearchHelp(ffw.Lightbox):
 <div class="codehilite"><pre>(summary:foo or text:foo) AND ticket_num:[* TO 50]</pre></div>
 <p>Tickets last modified in April 2012</p>
 <div class="codehilite"><pre>mod_date_dt:[2012-04-01T00:00:00Z TO 2012-04-30T23:59:59Z]</pre></div>
+<p>Private tickets</p>
+<div class="codehilite"><pre>private:true</pre></div>
+
 <h2>Saving searches</h2>
 <p>Ticket searches may be saved for later use by project administrators. To save a search, click "Edit Searches" in the tracker sidebar. Click "Add Bin" then enter a summary and search terms for the saved search. Your search will now show up in the sidebar under "Searches" with a count of how many tickets match the query.</p>
 <h2>Sorting search results</h2>
@@ -125,11 +131,13 @@ class SearchHelp(ffw.Lightbox):
 <li>Labels assigned to the ticket - labels_t</li>
 <li>Milestone the ticket is assigned to - _milestone_s</li>
 <li>Last modified date - mod_date_dt</li>
+<li>Created date - created_date_dt</li>
 <li>Body of the ticket - text_s</li>
 <li>Number of ticket - ticket_num_i</li>
 <li>User who created the ticket - reported_by_s</li>
 <li>Status of the ticket - status_s</li>
 <li>Title of the ticket - snippet_s</li>
+<li>Private ticket - private_b</li>
 <li>Custom field - the field name with an _ in front and _s at the end like _custom_s. For Boolean custom fields use _b instead of _s. For Number custom fields use _i.</li>
 </ul>
 <p>You can use these properties by appending them to the url (only one sort allowed at a time) like this:</p>


[3/6] git commit: [#2053] Use correct solr types for custom fields

Posted by jo...@apache.org.
[#2053] Use correct solr types for custom fields

Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/eaa0c871
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/eaa0c871
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/eaa0c871

Branch: refs/heads/master
Commit: eaa0c871a86e72373aed8b62f0db37a10b376cb6
Parents: 16ea266
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu May 2 15:18:23 2013 -0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri May 10 21:39:39 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py |   69 +++++++++++++++++++-----
 1 files changed, 56 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/eaa0c871/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 1e176e4..10259d0 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -47,6 +47,8 @@ from forgetracker.plugins import ImportIdConverter
 
 log = logging.getLogger(__name__)
 
+CUSTOM_FIELD_SOLR_TYPES = dict(boolean='_b', number='_i')
+
 config = utils.ConfigProxy(
     common_suffix='forgemail.domain')
 
@@ -131,6 +133,20 @@ class Globals(MappedClass):
                 return fld
         return None
 
+    def get_custom_field_solr_type(self, field_name):
+        """Return the Solr type for a custom field.
+
+        :param field_name: Name of the custom field
+        :type field_name: str
+        :returns: The Solr type suffix (e.g. '_s', '_i', '_b') or None if
+            there is no custom_field named ``field_name``.
+
+        """
+        fld = self.get_custom_field(field_name)
+        if fld:
+            return CUSTOM_FIELD_SOLR_TYPES.get(fld.type, '_s')
+        return None
+
     def update_bin_counts(self):
         # Refresh bin counts
         self._bin_counts_data = []
@@ -184,14 +200,23 @@ class Globals(MappedClass):
         tasks.update_bin_counts.post(self.app_config_id, delay=5)
 
     def sortable_custom_fields_shown_in_search(self):
-        return [dict(sortable_name='%s_s' % field['name'],
-                     name=field['name'],
-                     label=field['label'])
-                for field in self.custom_fields
-                if field.get('show_in_search')]
+        def solr_type(field_name):
+            # TODO POST-SOLR-REINDEX: Remove the following line. It temporarily
+            # forces the solr field type to string (_s) until the new index
+            # (with newly typed fields) is built.
+            return '_s'
+            return self.get_custom_field_solr_type(field_name) or '_s'
+
+        return [dict(
+            sortable_name='{0}{1}'.format(field['name'],
+                solr_type(field['name'])),
+            name=field['name'],
+            label=field['label'])
+            for field in self.custom_fields
+            if field.get('show_in_search')]
 
     def has_deleted_tickets(self):
-        return  Ticket.query.find(dict(
+        return Ticket.query.find(dict(
             app_config_id=c.app.config._id, deleted=True)).count() > 0
 
 
@@ -335,17 +360,29 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
             snippet_s=self.summary,
             votes_up_i=self.votes_up,
             votes_down_i=self.votes_down,
-            votes_total_i=(self.votes_up-self.votes_down),
+            votes_total_i=(self.votes_up - self.votes_down),
             import_id_s=ImportIdConverter.get().simplify(self.import_id)
             )
-        for k,v in self.custom_fields.iteritems():
-            result[k + '_s'] = unicode(v)
+        for k, v in self.custom_fields.iteritems():
+            field_value = unicode(v)
+            # Index all custom fields as Solr strings. This is actually wrong,
+            # but it's what the current code expects.
+            # TODO POST-SOLR-REINDEX: remove this line
+            result[k + '_s'] = field_value
+
+            # Now let's also index with proper Solr types. After reindexing to
+            # add these, remove the catch-all string-type indexing above.
+            solr_type = self.app.globals.get_custom_field_solr_type(k)
+            if solr_type:
+                result[k + solr_type] = field_value
+
         if self.reported_by:
             result['reported_by_s'] = self.reported_by.username
         if self.assigned_to:
             result['assigned_to_s'] = self.assigned_to.username
         # Tracker uses search with default solr parser. It would match only on
-        # `text`, so we're appending all other field values into `text`, to match on it too.
+        # `text`, so we're appending all other field values into `text`, to
+        # match on it too.
         result['text'] += pformat(result.values())
         return result
 
@@ -357,10 +394,16 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
     def translate_query(cls, q, fields):
         q = super(Ticket, cls).translate_query(q, fields)
         cf = [f.name for f in c.app.globals.custom_fields]
+        solr_field = '{0}{1}'
+        solr_type = '_s'
         for f in cf:
-            actual = '_%s_s' % f[1:]
-            base = f
-            q = q.replace(base+':', actual+':')
+            # TODO POST-SOLR-REINDEX: uncomment this line to enable searching
+            # on new properly typed solr fields instead of the old catch-all
+            # string fields.
+            # solr_type = (c.app.globals.get_custom_field_solr_type(f)
+                    # or solr_type)
+            actual = solr_field.format(f, solr_type)
+            q = q.replace(f + ':', actual + ':')
         return q
 
     @property


[6/6] git commit: [#2053] Fixed test failing due to missing mock custom field type

Posted by jo...@apache.org.
[#2053] Fixed test failing due to missing mock custom field type


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f89c9c10
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f89c9c10
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f89c9c10

Branch: refs/heads/master
Commit: f89c9c10a68184107dd4c9ab4dc41d6a6edbb6b0
Parents: ddfb987
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Mon May 13 16:23:26 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon May 13 16:23:26 2013 +0000

----------------------------------------------------------------------
 .../tests/unit/test_root_controller.py             |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f89c9c10/ForgeTracker/forgetracker/tests/unit/test_root_controller.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/unit/test_root_controller.py b/ForgeTracker/forgetracker/tests/unit/test_root_controller.py
index 79991e9..c6c3dc1 100644
--- a/ForgeTracker/forgetracker/tests/unit/test_root_controller.py
+++ b/ForgeTracker/forgetracker/tests/unit/test_root_controller.py
@@ -80,6 +80,7 @@ def mongo_search_returning_colors_are_wrong_ticket():
 def create_colors_are_wrong_ticket():
     set_tracker_custom_fields([dict(name='_iteration_number',
                                     label='Iteration Number',
+                                    type='number',
                                     show_in_search=True)])
     ticket = create_ticket(summary="colors are wrong",
                            custom_fields=dict(_iteration_number='Iteration 1'))


[2/6] git commit: [#2053] Update ticket search help

Posted by jo...@apache.org.
[#2053] Update ticket search help

Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8f9ce734
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8f9ce734
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8f9ce734

Branch: refs/heads/master
Commit: 8f9ce73460bf0f335520acee834261291a3fd9cd
Parents: d76add9
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue May 7 16:56:24 2013 -0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri May 10 21:39:39 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/widgets/ticket_search.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8f9ce734/ForgeTracker/forgetracker/widgets/ticket_search.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_search.py b/ForgeTracker/forgetracker/widgets/ticket_search.py
index 4444a60..6e97813 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_search.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_search.py
@@ -95,7 +95,7 @@ class SearchHelp(ffw.Lightbox):
 <li>User who owns the ticket - assigned_to</li>
 <li>Labels assigned to the ticket - labels</li>
 <li>Milestone the ticket is assigned to - _milestone</li>
-<li>Last modified date - mod_date_dt</li>
+<li>Last modified date - mod_date</li>
 <li>Body of the ticket - text</li>
 <li>Number of ticket - ticket_num</li>
 <li>User who created the ticket - reported_by</li>
@@ -130,7 +130,7 @@ class SearchHelp(ffw.Lightbox):
 <li>User who created the ticket - reported_by_s</li>
 <li>Status of the ticket - status_s</li>
 <li>Title of the ticket - snippet_s</li>
-<li>Custom field - the field name with an _ in front and _s at the end like _custom_s</li>
+<li>Custom field - the field name with an _ in front and _s at the end like _custom_s. For Boolean custom fields use _b instead of _s. For Number custom fields use _i.</li>
 </ul>
 <p>You can use these properties by appending them to the url (only one sort allowed at a time) like this:</p>
 <div class="codehilite"><pre>/p/yourproject/tickets/search/?q=_milestone:1.0&amp;sort=snippet_s+asc</pre></div></div>


[5/6] git commit: [#2053] Set correct indexing default for custom fields

Posted by jo...@apache.org.
[#2053] Set correct indexing default for custom fields

Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d76add9d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d76add9d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d76add9d

Branch: refs/heads/master
Commit: d76add9d7a344043b4b6b08b4edcd0d8ee440e9a
Parents: 1da9c34
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue May 7 16:46:32 2013 -0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri May 10 21:39:39 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d76add9d/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 3e2fde2..591495f 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -48,6 +48,11 @@ from forgetracker.plugins import ImportIdConverter
 log = logging.getLogger(__name__)
 
 CUSTOM_FIELD_SOLR_TYPES = dict(boolean='_b', number='_i')
+SOLR_TYPE_DEFAULTS = dict(_b=False, _i=0)
+
+
+def get_default_for_solr_type(solr_type):
+    return SOLR_TYPE_DEFAULTS.get(solr_type, u'')
 
 config = utils.ConfigProxy(
     common_suffix='forgemail.domain',
@@ -365,16 +370,16 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
             import_id_s=ImportIdConverter.get().simplify(self.import_id)
             )
         for k, v in self.custom_fields.iteritems():
-            field_value = unicode(v)
             # Pre solr-4.2.1 code expects all custom fields to be indexed
             # as strings.
             if not config.get_bool('new_solr'):
-                result[k + '_s'] = field_value
+                result[k + '_s'] = unicode(v)
 
             # Now let's also index with proper Solr types.
             solr_type = self.app.globals.get_custom_field_solr_type(k)
             if solr_type:
-                result[k + solr_type] = field_value
+                result[k + solr_type] = (v or
+                        get_default_for_solr_type(solr_type))
 
         if self.reported_by:
             result['reported_by_s'] = self.reported_by.username


[4/6] git commit: [#2053] Add config switch to control use of new solr fields

Posted by jo...@apache.org.
[#2053] Add config switch to control use of new solr fields

Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1da9c34b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1da9c34b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1da9c34b

Branch: refs/heads/master
Commit: 1da9c34bb27438f76921546cd93c32724cd05655
Parents: eaa0c87
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue May 7 16:11:33 2013 -0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri May 10 21:39:39 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/utils.py                |   11 +++++++-
 Allura/allura/tests/test_utils.py         |   22 +++++++++++++++-
 Allura/development.ini                    |    5 +++
 ForgeTracker/forgetracker/model/ticket.py |   32 ++++++++++++------------
 4 files changed, 52 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1da9c34b/Allura/allura/lib/utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
index c60f33b..2424930 100644
--- a/Allura/allura/lib/utils.py
+++ b/Allura/allura/lib/utils.py
@@ -37,6 +37,7 @@ from formencode import Invalid
 from tg.decorators import before_validate
 from pylons import response
 from pylons import tmpl_context as c
+from paste.deploy.converters import asbool
 from paste.httpheaders import CACHE_CONTROL, EXPIRES
 from webhelpers.html import literal
 from webob import exc
@@ -64,6 +65,7 @@ def guess_mime_type(filename):
         content_type = 'application/octet-stream'
     return content_type
 
+
 class ConfigProxy(object):
     '''Wrapper for loading config values at module-scope so we don't
     have problems when a module is imported before tg.config is initialized
@@ -73,7 +75,14 @@ class ConfigProxy(object):
         self._kw = kw
 
     def __getattr__(self, k):
-        return tg.config[self._kw[k]]
+        return self.get(k)
+
+    def get(self, key, default=None):
+        return tg.config.get(self._kw.get(key, key), default)
+
+    def get_bool(self, key):
+        return asbool(self.get(key))
+
 
 class lazy_logger(object):
     '''Lazy instatiation of a logger, to ensure that it does not get

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1da9c34b/Allura/allura/tests/test_utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_utils.py b/Allura/allura/tests/test_utils.py
index d20aa55..bd44ca2 100644
--- a/Allura/allura/tests/test_utils.py
+++ b/Allura/allura/tests/test_utils.py
@@ -23,7 +23,7 @@ from os import path
 
 import pylons
 from webob import Request
-from mock import Mock
+from mock import Mock, patch
 from nose.tools import assert_equal
 from pygments import highlight
 from pygments.lexers import get_lexer_for_filename
@@ -34,6 +34,26 @@ from allura import model as M
 from allura.lib import utils
 
 
+@patch.dict('allura.lib.utils.tg.config', clear=True, foo='bar', baz='true')
+class TestConfigProxy(unittest.TestCase):
+    def setUp(self):
+        self.cp = utils.ConfigProxy(mybaz="baz")
+
+    def test_getattr(self):
+        self.assertEqual(self.cp.foo, "bar")
+        self.assertEqual(self.cp.mybaz, "true")
+
+    def test_get(self):
+        self.assertEqual(self.cp.get("foo"), "bar")
+        self.assertEqual(self.cp.get("mybaz"), "true")
+        self.assertEqual(self.cp.get("fake"), None)
+        self.assertEqual(self.cp.get("fake", "default"), "default")
+
+    def test_get_bool(self):
+        self.assertEqual(self.cp.get_bool("mybaz"), True)
+        self.assertEqual(self.cp.get_bool("fake"), False)
+
+
 class TestChunkedIterator(unittest.TestCase):
 
     def setUp(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1da9c34b/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 737a08b..f485d17 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -182,6 +182,11 @@ solr.server = http://localhost:8983/solr
 solr.commit = false
 # commit add operations within N ms
 solr.commitWithin = 10000
+# Use improved data types for labels and custom fields?
+# New Allura deployments should leave this set to true. Existing deployments
+# should set to false until existing data has been reindexed. Reindexing will
+# convert existing label and custom field data to more appropriate solr types.
+solr.use_new_types = true
 
 # Forgemail server
 forgemail.host = 0.0.0.0

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1da9c34b/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 10259d0..3e2fde2 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -50,7 +50,8 @@ log = logging.getLogger(__name__)
 CUSTOM_FIELD_SOLR_TYPES = dict(boolean='_b', number='_i')
 
 config = utils.ConfigProxy(
-    common_suffix='forgemail.domain')
+    common_suffix='forgemail.domain',
+    new_solr='solr.use_new_types')
 
 class Globals(MappedClass):
 
@@ -201,10 +202,10 @@ class Globals(MappedClass):
 
     def sortable_custom_fields_shown_in_search(self):
         def solr_type(field_name):
-            # TODO POST-SOLR-REINDEX: Remove the following line. It temporarily
-            # forces the solr field type to string (_s) until the new index
-            # (with newly typed fields) is built.
-            return '_s'
+            # Pre solr-4.2.1 code indexed all custom fields as strings, so
+            # they must be searched as such.
+            if not config.get_bool('new_solr'):
+                return '_s'
             return self.get_custom_field_solr_type(field_name) or '_s'
 
         return [dict(
@@ -365,13 +366,12 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
             )
         for k, v in self.custom_fields.iteritems():
             field_value = unicode(v)
-            # Index all custom fields as Solr strings. This is actually wrong,
-            # but it's what the current code expects.
-            # TODO POST-SOLR-REINDEX: remove this line
-            result[k + '_s'] = field_value
+            # Pre solr-4.2.1 code expects all custom fields to be indexed
+            # as strings.
+            if not config.get_bool('new_solr'):
+                result[k + '_s'] = field_value
 
-            # Now let's also index with proper Solr types. After reindexing to
-            # add these, remove the catch-all string-type indexing above.
+            # Now let's also index with proper Solr types.
             solr_type = self.app.globals.get_custom_field_solr_type(k)
             if solr_type:
                 result[k + solr_type] = field_value
@@ -397,11 +397,11 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
         solr_field = '{0}{1}'
         solr_type = '_s'
         for f in cf:
-            # TODO POST-SOLR-REINDEX: uncomment this line to enable searching
-            # on new properly typed solr fields instead of the old catch-all
-            # string fields.
-            # solr_type = (c.app.globals.get_custom_field_solr_type(f)
-                    # or solr_type)
+            # Solr 4.2.1 index contains properly typed custom fields, so we
+            # can search on those instead of the old string-type solr fields.
+            if config.get_bool('new_solr'):
+                solr_type = (c.app.globals.get_custom_field_solr_type(f)
+                        or solr_type)
             actual = solr_field.format(f, solr_type)
             q = q.replace(f + ':', actual + ':')
         return q