Commit Graph

339 Commits

Author SHA1 Message Date
Jorge C. Leitão f2b9c062a6 Fixed #56 - Implements single valued field facets using Xapian.
Replaces the brute force _do_field_facets with
Xapian faceting for single valued facets.

Xapian does not support multi valued facets yet; thus
the brute force is used in this case.
2014-05-18 14:15:59 +02:00
Jorge C. Leitão 1b764d7ddf Removed dependency on type long; field_type can now be datetime. 2014-05-18 14:14:34 +02:00
Jorge C. Leitão d06da45d9d Simplified construction of Xapian queries. 2014-05-18 09:55:22 +02:00
Jorge C. Leitão 5d16d1aca7 Fixed #101 - Adds support to AutoQuery. 2014-05-18 09:49:11 +02:00
Jorge C. Leitão 4d51f5e9af Fixed #98 - queries are now consistent with Haystack 2.X.
Refactored _filter_contains query constructor.
2014-05-18 09:49:11 +02:00
Jorge C. Leitão 89691ce86a Added method to create OR queries from list of strings. 2014-05-18 09:49:11 +02:00
Jorge C. Leitão 99dc011a25 Refactored _filter_in query constructor. 2014-05-18 09:49:10 +02:00
Jorge C. Leitão 2969a74953 Refactored _filter_exact query constructor.
Its interface is explained in the docstring.
2014-05-18 09:49:10 +02:00
Jorge C. Leitão 83d10b6cc1 Refactored _filter_startswith query constructor.
Its interface is explained in the docstring.
2014-05-18 09:49:10 +02:00
Jorge C. Leitão 7e09d3d0b1 Refactored _phrase_query query constructor.
Its interface is explained in the docstring.
2014-05-18 09:49:10 +02:00
Jorge C. Leitão e7dfbae41f Refactored _term_query query constructor.
Its interface is explained in the docstring.
2014-05-18 09:49:10 +02:00
Jorge C. Leitão 98949009ab Modified how the query construction methods are chosen.
- "content" is a special field with generic search,
but now allow filters.
- parameter field_type is now retrieved from the backend and
passed to the construction methods.
2014-05-18 09:49:10 +02:00
Jorge C. Leitão f21e2c373c Added new argument on methods to build queries.
This allows more flexibility on constructing the queries.
For now the argument is not used.
2014-05-18 09:49:10 +02:00
Jorge C. Leitão 83bd8ee3e5 Reordered methods position in XapianSearchQuery.
Also removed two @staticmethod.
2014-05-18 09:49:10 +02:00
Jorge C. Leitão 93522bbd56 Changed name of variable from "field" to "field_name". 2014-05-18 09:49:09 +02:00
Jorge C. Leitão a27676a850 Fixed #111 - Removes Python error.
Added test to check it works.
2014-05-17 18:07:21 +02:00
jorgecarleitao 6c7cc9b5f5 Merge pull request #122 from jorgecarleitao/issue90
Fixed #90 - Adds support to fields "django_id" and "django_ct".
2014-05-16 23:32:34 +02:00
Jorge C. Leitão 01805d08f8 Fixed #112 - more_like_this raises InvalidIndexError for unindexed instance.
This doesn't happen if silently_fail is True, in which case returns
an empty result. Added test to cover both cases.
2014-05-15 08:26:33 +02:00
Jorge C. Leitão 61a68f3e27 Refactored xapian_backend.update.
Removed repeated code.
2014-05-14 23:21:43 +02:00
Jorge C. Leitão d22eb8d3f4 Refactored code.
Avoided starting TermGenerator for each object being indexed.
2014-05-14 23:13:39 +02:00
Jorge C. Leitão afb9958c4f Fixed #90 - Added fields django_id and django_ct.
- Fields are not fully indexed because they are not text.
- Added test of order_by django_id.
- Simplified code for updating index.
2014-05-14 21:34:39 +02:00
Jorge C. Leitão 6ed8569ef3 Made minor fixes related to code maintenance. 2014-05-11 21:02:47 +02:00
Jorge C. Leitão a7fdb8b291 Replaced force_unicode to force_text to Python3. 2014-05-11 20:27:24 +02:00
Jorge C. Leitão 3adaa23ef2 Dropped usage of cPickle to use just pickle. 2014-05-11 20:15:28 +02:00
Jorge C. Leitão a4b10dd31d Migrated strings to Python3 using unicode_literal. 2014-05-11 17:50:48 +02:00
Jorge C. Leitão 0d67bfb00b Simplified some conditions in the code. 2014-05-11 17:22:44 +02:00
Jorge C. Leitão b28a80b420 Fixed error that was causing a test to fail. 2014-05-11 17:05:47 +02:00
Jorge C. Leitão 024e10715b Removed _meta calls by using the haystack 'get_model_ct'. 2014-05-11 16:20:57 +02:00
Jorge C. Leitão 4874fffc3d Removed _meta calls by using the haystack 'get_model_ct'. 2014-05-11 09:21:50 +02:00
Jorge C. Leitão 5ef9ceb192 Improved backend interface and removed repeated loop. 2014-05-11 07:49:52 +02:00
Jorge C. Leitão 6fd59d2d67 Fixed #2 by making indexing of ID distinct from others. 2014-05-11 00:05:45 +02:00
Jorge C. Leitão c24abd182b Fixed #1 by making ID to be parsed as a non-text. 2014-05-10 23:33:31 +02:00
Jorge C. Leitão 8e0b982af9 Fixed error causing the cached _schema to not be updated.
- This was causing conflicts between tests, causing some to fail
  by that.
2014-05-10 21:49:16 +02:00
Jorge C. Leitão 7f3702a4a2 Fixed PEP8 errors and made minor simplifications. 2014-05-10 21:47:23 +02:00
David Sauve 37add92bc4 Don't open a writable database in clear method if we're going to rmtree. Only do so when required. Should fix issue GH-96. 2012-06-05 09:57:24 -07:00
David Sauve a4281e7cbd Updated narrow_queries in backend search to AND queries rather than OR. Thanks to naktinis for the original patch. 2012-05-28 16:06:07 -07:00
David Sauve f2be304c86 Merged upstream 2012-04-20 13:10:31 -07:00
David Sauve b2ec99d376 Explicitly close open database connection when not in use. Thanks domasx2. 2012-04-20 12:57:56 -07:00
David Sauve dcdc9eb319 Merged 2.0.X branch 2012-04-20 12:07:44 -07:00
David Sauve f9e17b7a01 Fixed pylint errors 2012-04-20 11:44:40 -07:00
David Sauve ec68cb0917 Updated copyright notice 2012-04-20 11:44:32 -07:00
David Sauve d97c0f2a78 Import settings from django.conf 2012-04-20 11:44:16 -07:00
David Sauve b089df8af4 Fixed improperly backported call to `super` in XapianSearchQuery. Thanks Jezdez! 2011-08-27 15:43:09 -07:00
kirov a37886df58 users can now specify a stemming language via settings.HAYSTACK_XAPIAN_LANGUAGE 2011-08-22 20:14:47 +04:00
David Sauve ccbd3bc0d9 Merge commit '0741a63bf8f8f35af5d7' 2011-08-08 20:23:09 -07:00
David Sauve bca561c29d Merged build_schema fix from master 2011-08-08 20:10:34 -07:00
David Sauve 2109b8913d Fixed leftover bits from pervious merge 2011-08-08 20:08:36 -07:00
David Sauve fdc84db098 Added sorting to build_schema method, added an always included id field, and updated tests for same. 2011-08-08 19:54:58 -07:00
David Sauve 687899d3bb Version number should probably remain beta since changes are mainly bug-fixes. 2011-08-08 15:16:13 -07:00
David Sauve 144b8cc86a Bumped version number to reflect changes from packed version 2011-08-08 15:15:27 -07:00
David Sauve dbf8eb65d3 Ported build_params method form master and 1.0.X branches. 2011-08-08 15:07:16 -07:00
David Sauve a8453772e5 Removed leftover run and run_mlt methods. Replaced with overriden build_params. This should fix gh-85 and gh-82. 2011-08-08 14:53:32 -07:00
Michael Opitz 0741a63bf8 added :memory: option 2011-07-17 17:50:35 +02:00
David Sauve 23ca1ed97a Updated copyright notice. 2011-07-14 16:14:07 -07:00
David Sauve d32dde1b7b Updated copyright notice. 2011-07-14 16:12:59 -07:00
David Sauve af9ca09f27 Merge remote branch 'toastdriven/multipleindex' into 2.0.X 2011-07-05 09:08:14 -07:00
David Sauve 710e9b7368 Updated SearchQuery._content_field to properly build phrase queries, restricting them to the document field. 2011-06-15 15:07:22 -07:00
David Sauve 6a7c2ef9bf Added overridable weighting scheme through the use of a new setting named HAYSTACK_XAPIAN_WEIGHTING_SCHEME. 2011-06-13 13:37:29 -07:00
David Sauve 712958f0db Fixed to allow boost on phrase as well as single terms 2011-05-11 14:13:34 -07:00
Daniel Lindsley b0a7505253 Updated Xapian for the multiple indexes support in Haystack 2.X. 2011-05-08 23:21:14 -05:00
Daniel Lindsley 8112cf383d Added a failing test to demonstrate that respecting the current site isn't working. 2011-05-03 15:37:30 -05:00
Daniel Lindsley 8d3bc1a4ee Fixed results to now include the ``site``. 2011-05-03 15:14:58 -05:00
Daniel Lindsley 3b3834d8ed Fixed a bug so that ``ValuesListQuerySet`` now works with the ``__in`` filter. 2011-05-03 15:03:29 -05:00
Daniel Lindsley 9afba72cae Added ``result_class`` compatibility to match the other Haystack backends. 2011-05-03 15:03:07 -05:00
David Sauve 4f05cf7b13 Import MoreLikeThisError. This resolves issue 72 2011-04-07 16:46:29 -07:00
David Sauve b6b92c85de Moved queryparser flags to an overrideable setting (HAYSTACK_XAPIAN_FLAGS). Default values are stored in DEFAULT_XAPIAN_FLAGS 2011-03-25 18:32:57 -07:00
David Sauve dc11c14542 Updated copyright information 2011-02-01 14:59:13 -08:00
David Sauve 027e9bf1f1 Removed check for writable path in __init__. Thanks to Jacob Kaplan-Moss for pointing it out. 2011-02-01 14:54:08 -08:00
David Sauve fce97acf33 Set database = None to force closing at the end of the update call. 2011-01-04 12:52:47 -08:00
David Sauve 0442a35594 Added custom run and run_mlt methods to SearchQuery 2011-01-04 11:20:54 -08:00
David Sauve 4cdd01f47f Updated version number for release. 2010-12-20 11:45:31 -08:00
David Sauve 29ae7f7672 Merged field_weights branch 2010-12-20 11:40:46 -08:00
David Sauve a07a980662 Fixed broken __startswith (removing FLAG_PARTIAL changed how this works). This closes issue #64. 2010-12-12 13:28:53 -08:00
David Sauve b8427fa20e Changed get_matches_estimated to size using all documents. This should be more accurate. 2010-11-10 12:36:02 -08:00
David Sauve e65cecdb55 Potential fix for count being out of sync on large datasets 2010-11-10 10:55:34 -08:00
David Sauve fb0f883cb3 Updated build_schema to use field_type parameter instead of isinstance as updated in Haystack. 2010-11-10 09:46:04 -08:00
David Sauve 350beefe98 Updated clear method to use rmtree instead of cycling through and removing each document individually. Thanks j00bar. 2010-10-27 10:26:50 -07:00
David Sauve cbaae41511 Removed FLAG_PARTIAL from parse_query method. Is not neccessary and consumes a lot resources. 2010-10-27 09:59:57 -07:00
David Sauve 9caf1d4f3c Updated to work with facet field changes introduced in Haystack SHA 1fb315525e8e77bc4c75ce4e485781fdd91ef649 2010-10-27 09:48:43 -07:00
David Sauve 5551d45e49 Removed weight argument from call to SearchResult in search call. 2010-10-03 14:15:33 -07:00
David Sauve 99435741b2 Removed weight attribute from SearchResults generated. Is not used by Haystack. Thanks to liranz for pointing this out. 2010-10-02 08:23:16 -07:00
David Sauve ea60ae1ffe SearchQuery._term_query will now properly build a query for field id and django_ct 2010-08-10 10:43:21 -07:00
David Sauve 5180f5f00c Revert "Merged field_weights branch"
This reverts commit 660af5f564.
2010-08-05 10:02:59 -04:00
David Sauve 660af5f564 Merged field_weights branch 2010-07-21 19:13:26 -04:00
David Sauve 28d7284205 Added number of terms to consider in more_like_this when using ELITE_SET 2010-05-28 14:41:09 -04:00
Sym Roe e4707203f4 Use OP_ELITE_SET rather than OP_OR in more_like_this.
Because performance is really bad when using OP_OR with a large database.
2010-05-29 02:23:24 +08:00
David Sauve ba47d7b361 Updated for compatibility with Xapian 1.2 by removing depracted method calls and slightly refactoring the way queries are constructed. 2010-05-13 14:08:28 -07:00
David Sauve 41762d7c42 Better testing for whitespace in term indexing 2010-03-11 12:11:14 -05:00
David Sauve 962585a40d Added a check to ensure that we don't try to index empty terms 2010-03-11 09:45:06 -05:00
David Sauve 9d8af9cbcf Changed SearchBackend.update so that it indexes terms with punctuation as well as using the Xapian.TermGenerator. This allows terms like URLs to work as expected 2010-03-05 15:33:14 -05:00
David Sauve 306a6f153f Changed to use to correspond to change in Haystack introduced in SHA 9255c9 2010-02-25 11:10:10 -05:00
David Sauve 3ce0ad120d Updated to mirror changes to faceting in Haystack that were introduced in SHA c8f8d 2010-02-19 09:47:58 -05:00
David Sauve 097808ca44 Corrected an issue with stemming that caused it to be skipped when searching without limiting to a field 2010-02-12 14:40:14 -05:00
David Sauve 46764499d7 Added BACKEND_NAME='xapian' constant to remain consistent with Haystack 2010-02-09 21:09:33 -05:00
David Sauve e794f53c99 Rewrote __starts_with filter to be much more effecient by using a query_parser for the query fragment to expand wildcards 2010-02-09 14:04:53 -05:00
David Sauve d0c5e4380a Added the ability to override field names within the index as added in Haystack SHA f3bf9b7f 2010-02-08 20:28:51 -05:00
David Sauve 10408d356a Changed all instance of enquire.get_mset to use a wrapped, safer, version of get_mset. This version should automatically attempt to reopen a database connection if xapian.DatabaseModifiedError is raised 2010-02-06 10:45:26 -05:00
David Sauve a4e60604a3 Updated SearchBackend.update to be smarter when indexing multi-value fields and stemming. Will now only stem text fields and will properly index each field of a MultiValueField. 2010-01-27 19:37:49 -05:00
David Sauve 8a7afd50ec No longer add multi-value field values to the value area of the Xapian index 2010-01-27 16:14:05 -05:00
David Sauve 8b9ec85f36 Calculate end_offset as doccount - start_offset when end_offset is None 2010-01-27 15:55:34 -05:00