Searching date fields?

7 views
Skip to first unread message

dan

unread,
Jul 25, 2010, 3:13:24 PM7/25/10
to gae-search
I need a DateProperty to be searchable. The following change seems to
work for me. Will this change hurt me in some way I don't understand?

Dan

P.S. Yes, I know, you encourage django-nonrel instead. However, it
might take me hours to convert over. I'd have to change my models,
queries, then perhaps even convert data of an existing app. I want to
limp along with gae-search as long as I can.

$ svn diff src/search/core.py
Index: src/search/core.py
===================================================================
--- src/search/core.py (revision 203)
+++ src/search/core.py (working copy)
@@ -451,7 +451,7 @@
elif not isinstance(values, (list, tuple)):
values = (values,)
for value in values:
- index.extend(self.splitter(value, indexing=True,
language=language))
+ index.extend(self.splitter("%s" % value,
indexing=True, language=language))
if self.indexer:
index = self.indexer(index, indexing=True,
language=language)
# Sort index to make debugging easier

Waldemar Kornewald

unread,
Jul 26, 2010, 6:54:44 AM7/26/10
to gae-s...@googlegroups.com
On Sun, Jul 25, 2010 at 9:13 PM, dan <dfra...@gmail.com> wrote:
> I need a DateProperty to be searchable. The following change seems to
> work for me. Will this change hurt me in some way I don't understand?
>
> Dan

You could use a custom splitter to handle this or you could write a
custom @property and index that. Modifying gae-search is not ideal.

Bye,
Waldemar Kornewald

--
Django on App Engine, MongoDB, ...? Browser-side Python? It's open-source:
http://www.allbuttonspressed.com/

Dan F

unread,
Jul 26, 2010, 9:53:37 AM7/26/10
to gae-s...@googlegroups.com
Yes, thanks. I ended up writing a custom splitter because I did not want date fields broken up across -s.

Dan


--
You received this message because you are subscribed to the Google Groups "gae-search" group.
To post to this group, send email to gae-s...@googlegroups.com.
To unsubscribe from this group, send email to gae-search+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gae-search?hl=en.




Reply all
Reply to author
Forward
0 new messages