notanumber / xapian-haystack

A Xapian backend for Haystack
GNU General Public License v2.0
154 stars 93 forks source link

Small microoptimizations & added ability to configure Xapian more #226

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hey, So in the past, when the original repo was not available I decided to port it under own workspace, thus I made small changes to existing code that bring up little higher compatibility with existing standards (f-string formatting, usage of memberships instead of multiple OR's) and I also added additional settings for ability to configure NGRAM:

NGRAM_MIN_LENGTH = getattr(settings, 'XAPIAN_NGRAM_MIN_LENGTH', 2)
NGRAM_MAX_LENGTH = getattr(settings, 'XAPIAN_NGRAM_MAX_LENGTH', 15)

The NGRAM settings are useful when you want to support single-character search, because originally this package does not support it (search-phrases must be minimum 2 characters long).

In addition I introduced ability to compile Xapian using all CPU cores, just using: ./install_xapian.sh --use-all-cores

Can we merge my own changes? I think it's nice addition to existing code - if you have any code review suggestions I will try to fix these in my spare time.

claudep commented 2 years ago

Totally agree with @asedeno review. We definitely want (some of) your changes, but please make separate PRs for each different concern, if this isn't too much work for you!

ghost commented 2 years ago

Closing since I splitted this pull request into multiple, smaller ones.