Граф коммитов

486 Коммитов

Автор SHA1 Сообщение Дата
Will Kahn-Greene bd64d60d29 Overhaul query docs
* changes some of the formatting so that we get interlinking for
  free
* add a bunch of things to the API section
* remove "verbose content" that duplicates content in the docstrings
  and in some cases was out-of-date or just plain wrong
2013-01-26 13:42:22 -05:00
Will Kahn-Greene 6fc64ac0de Add documentation; fix MappingType defaults
Adds a bunch of docstrings.

MappingType should be overridden. The get_indexes and
get_mapping_type_name methods were returning default values that
didn't make any sense. Better to raise NotImplementedError.
2013-01-26 13:41:11 -05:00
Will Kahn-Greene 690f4b31fd Implement execute
Previously you could only force an S to execute the search as a
side effect of requesting something out of it (count, facet_counts,
an iterable of results). This allows you to execute the search
and get back a SearchResults instance which has some interesting
things on it like a .results property which has the complete
ES response body.
2013-01-26 00:18:08 -05:00
Will Kahn-Greene 5c1676536f Tweak release process
We should run the sample docs to make sure they work correctly.
2013-01-19 15:42:16 -05:00
Will Kahn-Greene bec5319fcb Add quickstart to docs
I'm not sure this is the best quickstart, but it provides another
example that someone can copy and paste and fiddle with.
2013-01-19 15:41:04 -05:00
Will Kahn-Greene 18f497b5e1 Fix Indexable.refresh_index and es args
pyelasticsearch refresh doesn't take a timeout, so nixing that.

Additionally, it's more flexible if Indexable had its own get_es()
class method that it defaults to using that can be easily overridden.
So I tweaked that code a little.
2013-01-17 17:05:34 -05:00
Will Kahn-Greene f8e637e751 Add link to pyelasticsearch docs 2013-01-17 15:52:31 -05:00
Will Kahn-Greene b086f47a7c Tweak django tests to skip better
If django isn't installed, we want all the django tests to get skipped.
This fixes an issue with get_es not existing because it doesn't get
imported because django isn't installed.
2013-01-17 11:37:08 -05:00
Will Kahn-Greene dfee06475b Nix todo, add docs for bulk_index, fix requirements 2013-01-17 11:37:08 -05:00
Will Kahn-Greene 4afec1825a Nix max_retries; add ElasticSearch caching
* nixed max_retries because I personally think it's got a confusing
  name and, like revival_delay, it's probably not something someone is
  going to use often
* added caching of ElasticSearch object creation with tests
2013-01-17 11:37:08 -05:00
Will Kahn-Greene 4afdfe1ba9 Add bulk_indexing support to Indexable with tests 2013-01-17 11:37:08 -05:00
Will Kahn-Greene 114f0c99db Massive docs overhaul 2013-01-17 11:37:08 -05:00
Will Kahn-Greene 9bed7b5ce2 Update requirements
We require at least pyelasticsearch 0.3, but it's not out, yet.
2013-01-17 11:36:01 -05:00
Will Kahn-Greene 992155e8b4 Update sample_facets.py to new API
This updates it to the new API, uses pyelasticsearch, and tweaks
some of the comments.
2013-01-17 11:36:01 -05:00
Will Kahn-Greene 6ccf9dde3e Massive update to pyelasticsearch
* nix pyes things
* update to pyelasticsearch things
* fixes MLT so it works with pyelasticsearch (requires fixes that
  should be in pyelasticsearch 0.3 when that gets released)
* changes MLT fields argument to mlt_fields
* nixes all the dump curl code
* cleans up imports
* fixes defaults so that S defaults to searching all indexes and
  all doctypes
* adjusts errors so they all derive from ElasticUtilsError
* cleans up get_es() and S.get_es() so they're correct
* add DeprecationWarning for deprecated things
* update test code for MLT

In elasticutils.contrib.django:

* ditch the thread-local caching of ElasticSearch objects (we'll
  implement something better soon since pyelasticsearch's ElasticSearch
  objects are thread-safe)
* removed statsd code from the django-related code
* change ES_HOSTS to ES_URLS
* update index method (need to add a new bulk_index method)
* update test code for django-related bits
2013-01-17 11:36:01 -05:00
Will Kahn-Greene 1e2d795057 Update version to v0.7.dev 2013-01-17 11:36:00 -05:00
Will Kahn-Greene 033550b57a Tweak formatting in CHANGELOG 2013-01-17 09:58:15 -05:00
Will Kahn-Greene 5b371f9454 Prep for 0.6 release 2013-01-17 09:53:02 -05:00
Will Kahn-Greene fad62880a4 Issue #89. Added note that EU doesn't work with ES 0.19.9.
The problem is this one:

https://github.com/elasticsearch/elasticsearch/issues/2205

This was a bug in ElasticSearch 0.19.9 that was fixed in 0.19.10 so
I added a note to the docs stating ElasticUtils doesn't work with
ElasticSearch 0.19.9.
2013-01-17 09:23:29 -05:00
Will Kahn-Greene 86481a37ac Tweak sample_facets.py
* clarifies some of the comments
* adds a `.es()` chainable to the S so if someone changes the HOST,
  it's looking at the right place
2013-01-17 08:38:08 -05:00
Will Kahn-Greene e075dbe45c Add Mike to CONTRIBUTORS 2013-01-16 17:30:51 -05:00
Will Kahn-Greene d850af8b89 Implement prefix filter support 2013-01-16 17:30:26 -05:00
Will Kahn-Greene 4510d6af90 Fix test errors if django is not installed
If django is not installed, then we don't import get_es and then this
code fails. But we don't need the get_es method on QueryTest anyhow,
so this nixes it.
2013-01-16 17:30:26 -05:00
Will Kahn-Greene 197221b06a Merge pull request #91 from mythmon/run-tests-helper
Add run_tests.py to setup Django for testing.
2013-01-16 14:33:12 -08:00
Mike Cooper cddc7f6d02 Add run_tests.py to setup Django for testing.
This will set up the Django environment so the Django-specific tests can
run. If Django is not present, the setup will be skipped and the tests
will be run normally. The testsuite will skip any Django-specific tests
in this case. This simplifies running the full test suite.
2012-12-12 14:20:17 -08:00
Will Kahn-Greene 714a5c95ad Issue 90. Nix silly exception "handling"
The problem here is that it's logging as an error and then re-raising.
That's kind of irritating. It's better to just let it propagate back
to the application and let it do whatever it wants to do.

Amongst other things, this is less spammy with sentry.
2012-12-03 10:14:38 -05:00
Will Kahn-Greene ccff9b21fa Fix stupid mistakes
* I had a bad import, so the Django tests were getting skipped--fixed
  that.
* Fixing that unearthed failing tests--fixed those.
2012-10-17 11:14:00 -04:00
Will Kahn-Greene 1578b373d1 Issue 85. Fix IndexMissingException.
Alleviate problems from a bug in pyes 0.15.
2012-10-17 09:20:17 -04:00
Will Kahn-Greene 7dcc0344d2 Issue 84. Fix get_indexes/get_doctypes silliness
All the S.get_indexes() returned a list of indexes except the one
in Django contrib which could return a basestring or a list of
indexes.

Ditto for S.get_doctypes().

This fixes that, adds docs, and adds tests.
2012-10-17 09:19:48 -04:00
Will Kahn-Greene cd76217549 Fix v0.5/v0.6 issues in changelog 2012-10-16 15:47:25 -04:00
Will Kahn-Greene 675419fd8b Update hacking_howto about django reqs. 2012-09-21 19:10:35 -04:00
Will Kahn-Greene 374d224298 Fix boosted text_phrase queries
text_phrase queries are really just text queries, so they require the
same value_key name. This fixes that and also writes a test for boosts
that runs through ES so we can verify it doesn't kick up a
SeachPhaseWhateverThingy.
2012-09-21 18:54:27 -04:00
Will Kahn-Greene a478db3556 Update release date for 0.5; add TOC 2012-09-21 13:17:07 -04:00
Will Kahn-Greene 292e18dcdd Add Giorgos to CONTRIBUTORS list 2012-09-21 10:30:56 -04:00
Will Kahn-Greene afbd458f6f Update CHANGELOG 2012-09-20 16:57:33 -04:00
Will Kahn-Greene 456641049a Fix error from last commit
It's MaxRetryError--not MaxRetryException.
2012-09-20 15:03:45 -04:00
Will Kahn-Greene dc20e3de56 Fix es_required_or_50x decorator
This tweaks the es_required_or_50x decorator to handle other ElasticSearch
errors and also improves the documentation. It also allows for template
overrides and nixes the msg arguments--they seemed less flexible.

Note: These decorators have no tests in the test suite, yet.
2012-09-20 12:01:02 -04:00
Will Kahn-Greene 6e033446a5 Add note about refreshing after indexing. 2012-09-19 18:40:46 -04:00
Will Kahn-Greene 23bd386863 Add note about id and .index() 2012-09-19 15:29:50 -04:00
Will Kahn-Greene cefa09d19c Issue 74. Fix F operand mutations
Operations on F shouldn't mutate the operands. This fixes the code
so it does a deepcopy of the filters before doing things with them.
2012-09-14 13:30:53 -04:00
Will Kahn-Greene c2c1481af7 Tweak the filter caching text further. 2012-09-11 14:59:03 -04:00
Will Kahn-Greene 6b74736183 Add note about caching/speed in filter vs. query 2012-09-11 14:56:39 -04:00
Will Kahn-Greene ae2402822c Issue 70. Fix date_histogram handling.
* add handling for date_histogram in facet_counts
* fix facet_counts to raise an exception rather than silently act
  dumb if it doesn't recognize the _type
2012-09-07 16:40:22 -04:00
Will Kahn-Greene 547b6e2a0a Implement MappingType and rewrite everything around it
tl;dr: This is a big rewrite with huge API-breaking changes.

This replaces the old model-type system with the new MappingType
system. This adds a degree of separation between models (traditionally
stored in a db) and documents (stored in ElasticSearch).

Untyped S works just like in v0.4 with the exception that if you
don't specify values_dict or values_list, you now get back a list
of DefaultMappingType which are slightly more useful than dicts.

You can now create an S typed by a MappingType which makes it easier
to specify the index and doctype, but also allows you to tie
business logic to search results and also tie that back to db
objects in a lazy-loading way. For example, say you had a description
field and wanted to have a truncated version of it::

    class MyMappingType(MappingType):
        def description_truncated(self):
            return self.description[:100]

    res = list(S(MyMappingType).query(description__text='stormy night'))[0]

    print res.description_truncated()

Also, inextricably linked with this commit is a minor rewrite of the
test suite. They should run faster now, are better organized, and should
be easier to write in the future. test_django.py doesn't look like it
was written by a shrewdness of apes any more.

Also fixed a bug where `fields` was affected by ``values_list`` and
``values_dict`` calls---the two need to be separated.
2012-09-04 14:13:47 -04:00
Will Kahn-Greene b3a302345f Change _decorate_with_metadata to be less private 2012-09-04 13:44:52 -04:00
Will Kahn-Greene 4333f0b439 Add James Socol to CONTRIBUTORS
Bah--he contributed ages ago and I missed adding him.
2012-09-04 13:41:30 -04:00
Will Kahn-Greene e5952f7308 Set version to 0.6.dev 2012-09-04 13:31:32 -04:00
Will Kahn-Greene cc3e17cd18 Update CHANGELOG; prepare for v0.5 release 2012-09-04 13:30:35 -04:00
Will Kahn-Greene c457402521 Tweak the search chapter title
Since it uses the ES Search API, it's better to call it "Searching
with S" rather than "Querying with S".
2012-09-04 12:31:21 -04:00
Will Kahn-Greene 64b02a4d5d Re-add index to TOC. 2012-09-04 12:06:10 -04:00