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

is this good for "search" #1

Open
mixmix opened this issue Jan 16, 2020 · 2 comments
Open

is this good for "search" #1

mixmix opened this issue Jan 16, 2020 · 2 comments

Comments

@mixmix
Copy link
Member

mixmix commented Jan 16, 2020

I recently needed to make a "search by name" feature for the new sorts of profile I've made. Basically I need to search across several fields for some sort of partial match.

Example:
search : "ben"
should find:

  • records with preferredName like "james ben", or "Benjamin"
  • records with legalName like "Big Ben"
  • records with altNames like ["bj", "benny"]

I've implemented something simple with flumeview-search which I'm pretty happy with but also interested in trying this out.

Obvious challenges for a module like this :

  • case insensitivity
  • finding partial matches (e.g. a regexp /ben/)

This may be totally the wrong tool, but thought I'd put this test case at your doorstep in case it's of interest / use

@mixmix
Copy link
Member Author

mixmix commented Jan 16, 2020

Another thing I'm worried about for my use case is that I'm gonna be doing live search as people type. My understanding of this module is that it would create different indexes for individual searches ben and benj and benja etc.

@dominictarr
Copy link
Collaborator

Ah, I didn't really intend this for that sort of thing. as it currently is, the main reason it wouldn't work is that it uses a hash table and so you can't do partial matches... so if you typed "foo" it _couldn't match "food". maybe there are some ways you could work around this though.

you wouldn't want to rebuild indexes for each search because you probably don't do the same search again very often. building an index takes ~ 8 seconds, with a warm cache, which is okay if you are using an app that only has delay the first time. The way it works is if you do a query like root=<id> it builds indexes for every value of root, so any other query with root in it is now fast. Some times it might create indexes you don't need, say you query type=post it indexes every type, but you only ever query for posts. anyway, seemed like a reasonable trade off.

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