django-cms-search icon indicating copy to clipboard operation
django-cms-search copied to clipboard

Customize PageIndex

Open xmedia-systems opened this issue 12 years ago • 3 comments

Which way would you recommend to customize the page index created by cms_search? I'd like for example to set the text field to EdgeNgramField or make the title field indexable.

xmedia-systems avatar Jun 18 '12 16:06 xmedia-systems

Hi,

as far as I can tell, this is not really in scope of django-cms-search. You'll probably have to look at haystack for this (e.g. https://groups.google.com/forum/?fromgroups#!topic/django-haystack/j6f-z_-XQWE)

Kind regards, Benjamin

BTW: this is not really the place to get support, but to report issues and feature requests.

beniwohli avatar Jun 18 '12 16:06 beniwohli

Hi,

thank you for the quick reply! Well, the issue I'm having with django-cms-search is that only whole words are found in the index but not word parts. Autocompletion is also impossible. The quick and dirty solution is to change line 56 in search_indexes.py to

 text = indexes.EdgeNgramField(document=True, use_template=False)

instead of

 text = indexes.CharField(document=True, use_template=False)

but I'm looking for a better one. Like for example supplying an own base class for index and doing some magic in prepare(). Thought you have one in mind. If not I would like to request (and help to implement) such feature. For example make an option for supplying a custom page_index_factory.

Regards Alexey

xmedia-systems avatar Jun 19 '12 08:06 xmedia-systems

Ah, got you. I guess we could move the field definitions into a configurable base class.

beniwohli avatar Jun 19 '12 08:06 beniwohli