web/hdabo/search_indexes.py
author ymh <ymh.work@gmail.com>
Tue, 07 Jun 2011 13:18:56 +0200
changeset 11 143ab88d17f8
child 15 a9136d8f0b4a
permissions -rw-r--r--
add ordered manytomany fields and indexing
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
'''
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
Created on May 30, 2011
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
@author: ymh
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
'''
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
from haystack import site
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
from haystack.indexes import SearchIndex, CharField
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
from hdabo.models import Datasheet
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
class DatasheetIndex(SearchIndex):
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
    '''
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
    The search index for the datasheet
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
    '''
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
    text = CharField(document=True, use_template=True)
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
    hda_id = CharField(model_attr='hda_id', indexed=True, stored=True)
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
    
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
    
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
site.register(Datasheet, DatasheetIndex)