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

optimize tag autocompletion #99

Closed
jywarren opened this issue Jun 10, 2014 · 3 comments
Closed

optimize tag autocompletion #99

jywarren opened this issue Jun 10, 2014 · 3 comments
Labels
enhancement explains that the issue is to improve upon one of our existing features

Comments

@jywarren
Copy link
Member

Maybe by selecting fewer fields and/or sorting differently?

@btbonval
Copy link
Member

If tags aren't already indexed by string name, we should do that:
http://dev.mysql.com/doc/refman/5.0/en/create-index.html

CREATE INDEX tag_name_index
ON node_tag (name DESC)
USING BTREE;

or some such. Apparently MyISAM and InnoDB only support BTREE, so that doesn't need to be specified, and ASC/DESC is presently ignored by MySQL so that can be omitted as well.

Unsure how to add index using Rails migrations, but that'd probably be best.

This will optimize string searches against tags in the database. That should help autocompletion by speeding up the time to sort through the strings in the tag table.

@ananyo2012
Copy link
Member

I think this can be closed now. Here is the code that finds tag suggestions https://github.com/publiclab/plots2/blob/master/app/controllers/tag_controller.rb#L172-L175 Presently tags are queried by matching the tagname and upto a maximum of 10 tag suggestions

@jywarren
Copy link
Member Author

Here are the existing indices -- and I think we'll be relying on the solr search system for tag searches in the future, so I think we'll be OK to close this either way -- but curious if the name-based index here does the trick:

https://github.com/publiclab/plots2/blob/master/db/schema.rb.example#L371-L373

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement explains that the issue is to improve upon one of our existing features
Projects
None yet
Development

No branches or pull requests

3 participants