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

Add highlighting in results #22

Open
sylvinus opened this issue Feb 25, 2016 · 4 comments
Open

Add highlighting in results #22

sylvinus opened this issue Feb 25, 2016 · 4 comments

Comments

@sylvinus
Copy link
Contributor

Having parts of the results which matched in bold is a great visual aid.

An open question is: should we highlight results from the API as well? Or is that left to the client (in that case, to our JavaScript as well) ?

@JBaba
Copy link
Contributor

JBaba commented Mar 20, 2016

I think If we choose to do it in JavaScript then it comes to do post processing (after all search results are rendered).
But if it comes from the api then I think even static links will have that functionalities that's a plus. (am i wrong here ?)
one question when you say API means you are referring to GoLang or Python ?

@sylvinus
Copy link
Contributor Author

Yes, static links should be as close in functionality as possible, so we probably want to do this at the API / Go level, not JavaScript.

@JBaba
Copy link
Contributor

JBaba commented Mar 22, 2016

@sylvinus for this I am thinking doing something like this,

hitsByIds[hit.Id] = &Hit{
            ID:     ---,
            URL:    ----,   
            Title:   strings.Replace(hitsByIds[hit.Id].Title, " "+req.Query+" ", " <b>"+req.Query+"</b> ",-1),
            Summary: strings.Replace(hitsByIds[hit.Id].Summary, " "+req.Query+" ", " <b>"+req.Query+"</b> ",-1)}

This does not replaces map value but however,
If i run independent line it gives me proper replaced text,

fmt.Println(strings.Replace(hitsByIds[hit.Id].Title, " "+req.Query+" ", " <b>"+req.Query+"</b> ",-1))

Am i doing something wrong ? or you suggest this approach or something else ?

@sylvinus
Copy link
Contributor Author

This is a good start! You should really have a separate AddHighlighting() function that will grow over time as we include more improvements and edge cases!

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

No branches or pull requests

2 participants