File: whooshSymbolicQParser.py

package info (click to toggle)
thawab 4.1-2
  • links: PTS, VCS
  • area: non-free
  • in suites: bullseye, sid
  • size: 1,912 kB
  • sloc: python: 4,041; makefile: 134; sh: 33
file content (18 lines) | stat: -rw-r--r-- 453 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# -*- coding: UTF-8 -*-
"""

Copyright © 2010, Muayyad Alsadi <alsadi@ojuba.org>

"""

import sys, os, os.path, re

from whoosh import query
from whoosh.qparser import *

def MultifieldSQParser(fieldnames, schema = None, fieldboosts=None, **kwargs):
    p = MultifieldParser(fieldnames, schema, fieldboosts, **kwargs)
    cp = OperatorsPlugin(And = r"&", Or = r"\|", AndNot = r"&!", AndMaybe = r"&~", Not = r'!')
    p.replace_plugin(cp)
    return p