Changing Xapian stemming language

112 views
Skip to first unread message

Mario Menezes

unread,
Apr 23, 2012, 1:56:30 PM4/23/12
to django-...@googlegroups.com
Hi,

  I'm new to django-haystack and xapian. I've got them to work and I would like to change the stemming language used in Xapian.

  I've set 'HAYSTACK_XAPIAN_LANGUAGE':'portuguese', in my django settings. My Haystack entry looks like:

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.xapian_backend.XapianEngine',
        'PATH': os.path.join(os.path.dirname(__file__), 'xapian_index'),
        'HAYSTACK_XAPIAN_LANGUAGE':'portuguese',
    },
}

 Is this enough? Is this the correct language spelling ou code to use? Or should be something like ISO country codes? Could'nt find anything in docs"

 Thanks,

Mario

David Sauve

unread,
Apr 23, 2012, 2:02:53 PM4/23/12
to django-...@googlegroups.com
Hi Mario,

The language passed to the backend via `HAYSTACK_XAPIAN_LANGUAGE` is directly passed to Xapian with alteration so you should be able to use any of those listed here: http://xapian.org/docs/apidoc/html/classXapian_1_1Stem.html#6c46cedf2047b159a7e4c9d4468242b1

Once you've done that, you'll need to rebuild your index to have the term stemmed in your language of choice.

David
--
You received this message because you are subscribed to the Google Groups "django-haystack" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-haystack/-/7s8cncNevXUJ.
To post to this group, send email to django-...@googlegroups.com.
To unsubscribe from this group, send email to django-haysta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-haystack?hl=en.

Mario Menezes

unread,
Apr 23, 2012, 2:06:33 PM4/23/12
to django-...@googlegroups.com
Hi David,

 Thanks for your quick answer. I changed my language definition to "pt" but it seems it could be "portuguese" as I had set initially.

  Thanks again.


Em segunda-feira, 23 de abril de 2012 15h02min53s UTC-3, notanumber escreveu:
Hi Mario,

The language passed to the backend via `HAYSTACK_XAPIAN_LANGUAGE` is directly passed to Xapian with alteration so you should be able to use any of those listed here: http://xapian.org/docs/apidoc/html/classXapian_1_1Stem.html#6c46cedf2047b159a7e4c9d4468242b1

Once you've done that, you'll need to rebuild your index to have the term stemmed in your language of choice.

David

On Monday, 23 April, 2012 at 10:56 AM, Mario Menezes wrote:

Hi,

  I'm new to django-haystack and xapian. I've got them to work and I would like to change the stemming language used in Xapian.

  I've set 'HAYSTACK_XAPIAN_LANGUAGE':'portuguese', in my django settings. My Haystack entry looks like:

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.xapian_backend.XapianEngine',
        'PATH': os.path.join(os.path.dirname(__file__), 'xapian_index'),
        'HAYSTACK_XAPIAN_LANGUAGE':'portuguese',
    },
}

 Is this enough? Is this the correct language spelling ou code to use? Or should be something like ISO country codes? Could'nt find anything in docs"

 Thanks,

Mario

--
You received this message because you are subscribed to the Google Groups "django-haystack" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-haystack/-/7s8cncNevXUJ.
To post to this group, send email to django-haystack@googlegroups.com.
To unsubscribe from this group, send email to django-haystack+unsubscribe@googlegroups.com.

David Sauve

unread,
Apr 23, 2012, 2:07:57 PM4/23/12
to django-...@googlegroups.com
Sure thing.  I think either 'pt' or 'portuguese' should work.
To view this discussion on the web visit https://groups.google.com/d/msg/django-haystack/-/XG8rN2NzZeAJ.
To post to this group, send email to django-...@googlegroups.com.
To unsubscribe from this group, send email to django-haysta...@googlegroups.com.

Mario Menezes

unread,
Jun 11, 2012, 7:32:38 AM6/11/12
to django-...@googlegroups.com
Hi Nasmon,

  Thanks for your answer. I just forgot to do this. David have told me to do it, but I just forgot. Stemming seems to be working now.

  Best regards,

Em domingo, 10 de junho de 2012 04h49min40s UTC-3, Nasmon escreveu:
Hi Mario,

I believe, stemming is not working correctly, yet, in the new Xapian backend. Currently, it appears to be working for English only. And as stated in a previous post: Use HAYSTACK_XAPIAN_LANGUAGE directly in settings.py and not in HAYSTACK_CONNECTIONS. pt and  portuguese are both fine.
Reply all
Reply to author
Forward
0 new messages