equal
deleted
inserted
replaced
184 if text: |
184 if text: |
185 datastore_types.ValidateString(text, 'text', max_len=sys.maxint) |
185 datastore_types.ValidateString(text, 'text', max_len=sys.maxint) |
186 text = cls._PUNCTUATION_REGEX.sub(' ', text) |
186 text = cls._PUNCTUATION_REGEX.sub(' ', text) |
187 words = text.lower().split() |
187 words = text.lower().split() |
188 |
188 |
189 words = set(words) |
189 words = set(unicode(w) for w in words) |
190 |
190 |
191 words -= cls._FULL_TEXT_STOP_WORDS |
191 words -= cls._FULL_TEXT_STOP_WORDS |
192 for word in list(words): |
192 for word in list(words): |
193 if len(word) < cls._FULL_TEXT_MIN_LENGTH: |
193 if len(word) < cls._FULL_TEXT_MIN_LENGTH: |
194 words.remove(word) |
194 words.remove(word) |
249 for keyword in keywords: |
249 for keyword in keywords: |
250 filter = pb.add_filter() |
250 filter = pb.add_filter() |
251 filter.set_op(datastore_pb.Query_Filter.EQUAL) |
251 filter.set_op(datastore_pb.Query_Filter.EQUAL) |
252 prop = filter.add_property() |
252 prop = filter.add_property() |
253 prop.set_name(SearchableEntity._FULL_TEXT_INDEX_PROPERTY) |
253 prop.set_name(SearchableEntity._FULL_TEXT_INDEX_PROPERTY) |
254 prop.mutable_value().set_stringvalue(keyword) |
254 prop.mutable_value().set_stringvalue(unicode(keyword).encode('utf-8')) |
255 |
255 |
256 return pb |
256 return pb |
257 |
257 |
258 |
258 |
259 class SearchableModel(db.Model): |
259 class SearchableModel(db.Model): |