mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Removed object_indexed and Indexed.indexed attribute
This commit is contained in:
parent
aea535f6d4
commit
8ef25e9ed6
@ -261,12 +261,6 @@ class Page(MP_Node, ClusterableModel, Indexed):
|
||||
cursor.execute(update_statement,
|
||||
[new_url_path, len(old_url_path) + 1, self.path + '%', self.id])
|
||||
|
||||
def object_indexed(self):
|
||||
# Exclude root node from index
|
||||
if self.depth == 1:
|
||||
return False
|
||||
return True
|
||||
|
||||
@property
|
||||
def specific(self):
|
||||
"""
|
||||
|
@ -1,4 +1,3 @@
|
||||
from indexed import Indexed
|
||||
from searcher import Searcher
|
||||
from signal_handlers import register_signal_handlers
|
||||
from backends import get_search_backend
|
@ -17,14 +17,6 @@ class BaseSearch(object):
|
||||
if not isinstance(obj, Indexed) or not isinstance(obj, models.Model):
|
||||
return False
|
||||
|
||||
# Check if this objects model has opted out of indexing
|
||||
if not obj.__class__.indexed:
|
||||
return False
|
||||
|
||||
# Check if this object has an "object_indexed" function
|
||||
if hasattr(obj, "object_indexed"):
|
||||
if obj.object_indexed() is False:
|
||||
return False
|
||||
return True
|
||||
|
||||
def reset_index(self):
|
||||
|
@ -121,10 +121,6 @@ class ElasticSearch(BaseSearch):
|
||||
self.es.create_index(self.es_index, INDEX_SETTINGS)
|
||||
|
||||
def add_type(self, model):
|
||||
# Make sure that the model is indexed
|
||||
if not model.indexed:
|
||||
return
|
||||
|
||||
# Get type name
|
||||
content_type = model.indexed_get_content_type()
|
||||
|
||||
|
@ -75,4 +75,3 @@ class Indexed(object):
|
||||
return doc
|
||||
|
||||
indexed_fields = ()
|
||||
indexed = True
|
||||
|
@ -2,7 +2,6 @@ from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
from indexed import Indexed
|
||||
from searcher import Searcher
|
||||
import datetime
|
||||
import string
|
||||
|
||||
@ -100,13 +99,6 @@ class SearchTest(models.Model, Indexed):
|
||||
|
||||
indexed_fields = ("title", "content", "callable_indexed_field", "live")
|
||||
|
||||
title_search = Searcher(["title"])
|
||||
|
||||
def object_indexed(self):
|
||||
if self.title == "Don't index me!":
|
||||
return False
|
||||
return True
|
||||
|
||||
def callable_indexed_field(self):
|
||||
return "Callable"
|
||||
|
||||
|
@ -72,17 +72,6 @@ class BackendTests(object):
|
||||
single_result = results[0]
|
||||
multi_result = results[:2]
|
||||
|
||||
def test_object_indexed(self):
|
||||
# Attempt to index something that the models.SearchTest.object_indexed command says should be blocked
|
||||
test = models.SearchTest()
|
||||
test.title = "Don't index me!"
|
||||
test.save()
|
||||
self.backend.refresh_index()
|
||||
|
||||
# Try to search for this record, It shouldn't be in the index
|
||||
results = self.backend.search("Don't index me!", models.SearchTest)
|
||||
self.assertEqual(len(results), 0)
|
||||
|
||||
def test_callable_indexed_field(self):
|
||||
# Get results
|
||||
results = self.backend.search("Callable", models.SearchTest)
|
||||
@ -150,10 +139,6 @@ class TestDBBackend(TestCase, BackendTests):
|
||||
self.backend = get_search_backend('wagtail.wagtailsearch.backends.db.DBSearch')
|
||||
self.load_test_data()
|
||||
|
||||
@unittest.expectedFailure
|
||||
def test_object_indexed(self):
|
||||
super(TestDBBackend, self).test_object_indexed()
|
||||
|
||||
@unittest.expectedFailure
|
||||
def test_callable_indexed_field(self):
|
||||
super(TestDBBackend, self).test_callable_indexed_field()
|
||||
|
Loading…
Reference in New Issue
Block a user