Skip to content

Instantly share code, notes, and snippets.

@colonelrascals
Created March 13, 2018 16:35
Show Gist options
  • Select an option

  • Save colonelrascals/233a37a7f3f5fb8a0fe00f420f2b44ef to your computer and use it in GitHub Desktop.

Select an option

Save colonelrascals/233a37a7f3f5fb8a0fe00f420f2b44ef to your computer and use it in GitHub Desktop.
def indexing(self):
obj = UserDoc(
meta={"id": self.id},
email=self.email,
first_name=self.first_name,
last_name=self.last_name,
date_joined=self.date_joined,
expertise=self.expertise_str,
institution=self.institution,
position=self.position,
name_suggest=self.full_name,
)
print obj
obj.save(index="users2")
return obj.to_dict(include_meta=True)
# @users_index.doc_type
class User(DocType):
email = Text()
first_name = Text()
last_name = Text()
date_joined = Date()
expertise = Text()
institution = Text()
position = Text()
# autocomplete fields
name_suggest = Completion(analyzer=analyzer("standard"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment