diff --git a/rhodecode/lib/indexers/__init__.py b/rhodecode/lib/indexers/__init__.py --- a/rhodecode/lib/indexers/__init__.py +++ b/rhodecode/lib/indexers/__init__.py @@ -31,17 +31,7 @@ from os.path import dirname as dn, join sys.path.append(dn(dn(dn(os.path.realpath(__file__))))) from string import strip - -from rhodecode.model import init_model -from rhodecode.model.scm import ScmModel -from rhodecode.config.environment import load_environment -from rhodecode.lib.utils import BasePasterCommand, Command, add_cache - from shutil import rmtree -from webhelpers.html.builder import escape -from vcs.utils.lazy import LazyProperty - -from sqlalchemy import engine_from_config from whoosh.analysis import RegexTokenizer, LowercaseFilter, StopFilter from whoosh.fields import TEXT, ID, STORED, Schema, FieldType @@ -49,15 +39,18 @@ from whoosh.index import create_in, open from whoosh.formats import Characters from whoosh.highlight import highlight, SimpleFragmenter, HtmlFormatter +from webhelpers.html.builder import escape +from sqlalchemy import engine_from_config +from vcs.utils.lazy import LazyProperty + +from rhodecode.model import init_model +from rhodecode.model.scm import ScmModel +from rhodecode.config.environment import load_environment +from rhodecode.lib import LANGUAGES_EXTENSIONS_MAP +from rhodecode.lib.utils import BasePasterCommand, Command, add_cache #EXTENSIONS WE WANT TO INDEX CONTENT OFF -INDEX_EXTENSIONS = ['action', 'adp', 'ashx', 'asmx', 'aspx', 'asx', 'axd', 'c', - 'cfg', 'cfm', 'cpp', 'cs', 'css', 'diff', 'do', 'el', 'erl', - 'h', 'htm', 'html', 'ini', 'java', 'js', 'jsp', 'jspx', 'lisp', - 'lua', 'm', 'mako', 'ml', 'pas', 'patch', 'php', 'php3', - 'php4', 'phtml', 'pm', 'py', 'rb', 'rst', 's', 'sh', 'sql', - 'tpl', 'txt', 'vim', 'wss', 'xhtml', 'xml', 'xsl', 'xslt', - 'yaws'] +INDEX_EXTENSIONS = LANGUAGES_EXTENSIONS_MAP.keys() #CUSTOM ANALYZER wordsplit + lowercase filter ANALYZER = RegexTokenizer(expression=r"\w+") | LowercaseFilter() @@ -203,8 +196,9 @@ class ResultWrapper(object): Smart function that implements chunking the content but not overlap chunks so it doesn't highlight the same close occurrences twice. - @param matcher: - @param size: + + :param matcher: + :param size: """ memory = [(0, 0)] for span in self.matcher.spans():