Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Person Alternate names not used in search, Person view #19

Open
dsblank opened this issue Jan 12, 2017 · 3 comments
Open

Person Alternate names not used in search, Person view #19

dsblank opened this issue Jan 12, 2017 · 3 comments

Comments

@dsblank
Copy link
Member

dsblank commented Jan 12, 2017

The Person object has a list of alternate names. These do not show, and are not used in a search.

Two options:

  1. create a new table, and use that for Person.
  2. at least search those fields (harder, as it is a nested list)

The problem with 1 is that the number of names is different from the number of people. Does it matter?

@romjerome
Copy link
Contributor

romjerome commented Jan 12, 2017 via email

@dsblank
Copy link
Member Author

dsblank commented Jan 12, 2017

@romjerome We could stick all of the names in a single field (as the commit you point to shows), but that will not make searches or ordering fast. In fact, it would make them slower. Also, it is confusing when searching for a name, and the matching row doesn't show the criteria. I think the right solution is to actually use a bit of relational databasing, and do a JOIN between the person table, and a new name table. That will solve all of the problems identified, keep searching fast, and the displayed data informative.

@dsblank
Copy link
Member Author

dsblank commented Jan 13, 2017

This turned out to be really easy to fix. I have a prototype, but not yet complete.

  1. First, one can make a VIEW in SQL that looks just like the person table, but it has a row for each primary + alternate_name. Something like: db.dbapi.execute("CREATE VIEW name_person AS SELECT * from person, name WHERE person.handle = name.handle ORDER BY surname, first_name;") But don't include the secondary name fields from person. The name table will have those. The order will depend on the display_name format? Maybe have no order... can there be indexes on views?
  2. In the actual selection, simply use the name_person table rather than person. Everything should work fine.
  3. Can we have a display_name that works in Python and SQL? That way, the column shown will exactly match the order. Perhaps another use of the ast.
  4. Make sure to update the name_person table when person data changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants