Exemplo n.º 1
0
class PageHit(DocType):
    doc_id = Long()
    fc_user_id = Long()
    product_id = Long()

    permissions = Long(multi=True)
    access_time = Date()
    origin_ip = Ip()
    request_type = Text()
    uri = Text()
    page_number = Long()
    is_full = Boolean()
    is_known_article = Boolean()
    is_known_product = Boolean()

    class Meta:
        index = 'hits'

    def save(self, **kwargs):
        return super(PageHit, self).save(**kwargs)

    @classmethod
    def properties(cls):
        props = PageHit._doc_type.mapping.properties.to_dict(
        )['doc']['properties'].keys()
        return [prop for prop in props]
Exemplo n.º 2
0
    def get_es_mapping(cls):
        es_mapping = super(Topic, cls).get_es_mapping()

        es_mapping.field('title', Text(boost=1.5))
        es_mapping.field('tags', Text(boost=2.0))
        es_mapping.field('subtitle', Text())
        es_mapping.field('is_solved', Boolean())
        es_mapping.field('is_locked', Boolean())
        es_mapping.field('is_sticky', Boolean())
        es_mapping.field('pubdate', Date())
        es_mapping.field('forum_pk', Integer())

        # not indexed:
        es_mapping.field('get_absolute_url', Keyword(index=False))
        es_mapping.field('forum_title', Text(index=False))
        es_mapping.field('forum_get_absolute_url', Keyword(index=False))

        return es_mapping
Exemplo n.º 3
0
    def get_es_mapping(cls):
        es_mapping = super(Topic, cls).get_es_mapping()

        es_mapping.field("title", Text(boost=1.5))
        es_mapping.field("tags", Text(boost=2.0))
        es_mapping.field("subtitle", Text())
        es_mapping.field("is_solved", Boolean())
        es_mapping.field("is_locked", Boolean())
        es_mapping.field("is_sticky", Boolean())
        es_mapping.field("pubdate", Date())
        es_mapping.field("forum_pk", Integer())

        # not indexed:
        es_mapping.field("get_absolute_url", Keyword(index=False))
        es_mapping.field("forum_title", Text(index=False))
        es_mapping.field("forum_get_absolute_url", Keyword(index=False))

        return es_mapping
Exemplo n.º 4
0
    def get_es_mapping(cls):
        es_mapping = super(Post, cls).get_es_mapping()

        es_mapping.field('text_html', Text())
        es_mapping.field('is_useful', Boolean())
        es_mapping.field('is_visible', Boolean())
        es_mapping.field('position', Integer())
        es_mapping.field('like_dislike_ratio', Float())
        es_mapping.field('pubdate', Date())
        es_mapping.field('forum_pk', Integer())
        es_mapping.field('topic_pk', Integer())

        # not indexed:
        es_mapping.field('get_absolute_url', Keyword(index=False))
        es_mapping.field('topic_title', Text(index=False))
        es_mapping.field('forum_title', Text(index=False))
        es_mapping.field('forum_get_absolute_url', Keyword(index=False))

        return es_mapping
Exemplo n.º 5
0
    def get_es_mapping(cls):
        es_mapping = super(Post, cls).get_es_mapping()

        es_mapping.field("text_html", Text())
        es_mapping.field("is_useful", Boolean())
        es_mapping.field("is_visible", Boolean())
        es_mapping.field("position", Integer())
        es_mapping.field("like_dislike_ratio", Float())
        es_mapping.field("pubdate", Date())
        es_mapping.field("forum_pk", Integer())
        es_mapping.field("topic_pk", Integer())

        # not indexed:
        es_mapping.field("get_absolute_url", Keyword(index=False))
        es_mapping.field("topic_title", Text(index=False))
        es_mapping.field("forum_title", Text(index=False))
        es_mapping.field("forum_get_absolute_url", Keyword(index=False))

        return es_mapping
Exemplo n.º 6
0
class Email(DocType):
    # {u'Address': u'*****@*****.**',
    Address = String(index='not_analyzed')
    # u'Body': u' ---------------------- footnotes ---------------------- ',
    Body = String(analyzer='snowball')
    # u'Date': u'08/01/2015',
    Date = ESDate()
    # SKIP: u'Month': u'08',
    # u'Name': u'Senator Bernie Sanders',
    # Confusing since there's also a 'name' field
    Name = String(index='not_analyzed')
    x_name_suggest = Completion()
    # u'Subject': u'Bernie Buzz: Fight for $15!',
    Subject = String(analyzer='snowball')
    # SKIP: u'Year': u'2015',
    # u'alignment': u'Align',
    alignment = String(index='not_analyzed')
    # u'bioguideid': u'S000033',
    bioguideid = String(index='not_analyzed')
    # u'birthday': u'1941-09-08',
    birthday = ESDate()
    # u'caucus': u'Democrat',
    caucus = String(index='not_analyzed')
    # u'congress_numbers': [113, 114, 115],
    congress_numbers = String(index='not_analyzed', multi=True)
    # u'cspanid': 994,
    cspanid = String(index='not_analyzed')
    # u'current': True,
    current = Boolean()
    # u'description': u'Junior Senator from Vermont',
    description = String(analyzer='snowball')
    # u'district': None,
    district = String(index='not_analyzed')
    # u'enddate': u'2019-01-03',
    enddate = ESDate()
    # u'firstname': u'Bernard',
    firstname = String(analyzer='snowball')
    # u'gender': u'male',
    gender = String(index='not_analyzed')
    # SKIP: u'gender_label': u'Male',
    # u'id': 400357,
    id = String(index='not_analyzed')
    # u'lastname': u'Sanders',
    lastname = String(analyzer='snowball')
    # u'leadership_title': None,
    leadership_title = String(analyzer='snowball')
    # u'link': u'https://www.govtrack.us/congress/members/bernard_sanders/400357',
    link = String(index='not_analyzed')
    # u'middlename': u'',
    middlename = String(analyzer='snowball')
    # u'name': u'Sen. Bernard \u201cBernie\u201d Sanders [I-VT]',
    name = String(index='not_analyzed')
    # u'namemod': u'',
    namemod = String(index='not_analyzed')
    # u'nickname': u'Bernie',
    nickname = String(analyzer='snowball')
    # u'osid': u'N00000528',
    osid = String(index='not_analyzed')
    # u'party': u'Independent',
    party = String(index='not_analyzed')
    # u'phone': u'202-224-5141',
    phone = String(index='not_analyzed')
    # u'polarity': u'None',
    polarity = Float()
    # u'pvsid': u'27110',
    pvsid = String(index='not_analyzed')
    # u'role_type': u'senator',
    role_type = String(index='not_analyzed')
    # SKIP: u'role_type_label': u'Senator',
    # u'senator_class': u'class1',
    senator_class = String(index='not_analyzed')
    # SKIP: u'senator_class_label': u'Class 1',
    # u'senator_rank': u'junior',
    senator_rank = String(index='not_analyzed')
    # SKIP: u'senator_rank_label': u'Junior',
    senator_rank_label = String(index='not_analyzed')
    # u'sortname': u'Sanders, Bernard \u201cBernie\u201d (Sen.) [I-VT]',
    sortname = String(index='not_analyzed')
    # u'startdate': u'2013-01-03',
    startdate = ESDate()
    # u'state': u'VT',
    state = String(index='not_analyzed')
    # u'title': u'Sen.',
    title = String(index='not_analyzed')
    # u'title_long': u'Senator',
    title_long = String(analyzer='snowball')
    # u'twitterid': u'SenSanders',
    twitterid = String(index='not_analyzed')
    # u'website': u'http://www.sanders.senate.gov',
    website = String(index='not_analyzed')
    # u'youtubeid': u'senatorsanders'}
    youtubeid = String(index='not_analyzed')

    class Meta:
        index = 'emails'

    def save(self, **kwargs):
        return super(Email, self).save(**kwargs)

    @classmethod
    def properties(cls):
        return [
            prop for prop in Email._doc_type.mapping.properties.to_dict()
            ['email']['properties'].keys() if not prop.startswith('x_')
        ]