##// END OF EJS Templates
whoosh: fallback schema uses now bigger ints, fixes #4035
marcink -
r413:f591e19f default
parent child Browse files
Show More
@@ -1,75 +1,75 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2012-2016 RhodeCode GmbH
4 4 #
5 5 # This program is free software: you can redistribute it and/or modify
6 6 # it under the terms of the GNU Affero General Public License, version 3
7 7 # (only), as published by the Free Software Foundation.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU Affero General Public License
15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16 #
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 """
22 22 Whoosh fallback schema for RhodeCode in case rhodecode_tools defined one is
23 23 not available
24 24 """
25 25
26 26 from __future__ import absolute_import
27 27
28 28 from whoosh.analysis import RegexTokenizer, LowercaseFilter
29 29 from whoosh.formats import Characters
30 30 from whoosh.fields import (
31 31 TEXT, ID, STORED, NUMERIC, BOOLEAN, Schema, FieldType, DATETIME)
32 32
33 33 # CUSTOM ANALYZER wordsplit + lowercase filter for case insensitive search
34 34 ANALYZER = RegexTokenizer(expression=r"\w+") | LowercaseFilter()
35 35
36 36 # FILE INDEX SCHEMA DEFINITION
37 37 FILE_INDEX_NAME = 'FILE_INDEX'
38 38 FILE_SCHEMA = Schema(
39 39 fileid=ID(unique=True), # Path
40 40 repository=ID(stored=True),
41 41 repository_id=NUMERIC(unique=True, stored=True), # Numeric id of repo
42 42 repo_name=TEXT(stored=True),
43 43 owner=TEXT(),
44 44 path=TEXT(stored=True),
45 45 content=FieldType(format=Characters(), analyzer=ANALYZER,
46 46 scorable=True, stored=True),
47 47 modtime=STORED(),
48 48 md5=STORED(),
49 49 extension=ID(stored=True),
50 50 commit_id=TEXT(stored=True),
51 51
52 size=NUMERIC(stored=True),
52 size=NUMERIC(int, 64, signed=False, stored=True),
53 53 mimetype=TEXT(stored=True),
54 lines=NUMERIC(stored=True),
54 lines=NUMERIC(int, 64, signed=False, stored=True),
55 55 )
56 56
57 57
58 58 # COMMIT INDEX SCHEMA
59 59 COMMIT_INDEX_NAME = 'COMMIT_INDEX'
60 60 COMMIT_SCHEMA = Schema(
61 61 commit_id=ID(unique=True, stored=True),
62 62 repository=ID(unique=True, stored=True),
63 63 repository_id=NUMERIC(unique=True, stored=True),
64 64 commit_idx=NUMERIC(stored=True, sortable=True),
65 65 commit_idx_sort=ID(),
66 date=NUMERIC(stored=True, sortable=True),
66 date=NUMERIC(int, 64, signed=False, stored=True, sortable=True),
67 67 owner=TEXT(stored=True),
68 68 author=TEXT(stored=True),
69 69 message=FieldType(format=Characters(), analyzer=ANALYZER,
70 70 scorable=True, stored=True),
71 71 parents=TEXT(stored=True),
72 72 added=TEXT(stored=True), # space separated names of added files
73 73 removed=TEXT(stored=True), # space separated names of removed files
74 74 changed=TEXT(stored=True), # space separated names of changed files
75 75 )
General Comments 0
You need to be logged in to leave comments. Login now