Skip to content

WIP: Initial work to extract examples from the FOSDEM15 talk#32

Open
TechplexEngineer wants to merge 4 commits intoblevesearch:masterfrom
TechplexEngineer:add-query-examples
Open

WIP: Initial work to extract examples from the FOSDEM15 talk#32
TechplexEngineer wants to merge 4 commits intoblevesearch:masterfrom
TechplexEngineer:add-query-examples

Conversation

@TechplexEngineer
Copy link

Per the discussion in #31 here is the beginnings of work to add examples to the docs

Copy link
Contributor

@mschoch mschoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good start, just a few minor suggestions.


q := bleve.NewTermQuery("golden")
req := bleve.NewSearchRequest(q)
req.Highlight = bleve.NewHighlightWithStyle("html")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking that to keep these examples short and focused on how to use the query type being discussed, we should remove the lines which set req.Highlight.

q := bleve.NewTermQuery("golden")
req := bleve.NewSearchRequest(q)
req.Highlight = bleve.NewHighlightWithStyle("html")
req.Fields = []string{"discription"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And same for req.Fields, it isn't required for this example and might confuse users about whether it is required or not.

log.Fatal(err)
}

fq := bleve.NewFuzzyQuery("Citrus") // HLBLEVE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove the comment // HLBLEVE that was added to highlight the line in a particular way in the presentation.

@TechplexEngineer
Copy link
Author

Thanks for the input. As I work through this I'm wondering if more targeted examples with just the lines relevant to the query being discussed would be better. Rather than show a complete working program which gets quite repetitive and verbose, we would just show:

tq1 := bleve.NewTermQuery("golden")
tq2 := bleve.NewTermQuery("Citrus")
q := bleve.NewConjunctionQuery([]bleve.Query{tq1, tq2})
req := bleve.NewSearchRequest(q)

I'm thinking a better place for the more complete examples would be in an /examples directory in the beer-search example application.

Thoughts?

@mschoch
Copy link
Contributor

mschoch commented Feb 11, 2021

Rather than show a complete working program which gets quite repetitive and verbose

Maybe we have one complete example at the top, featuring MatchQuery since it is the most common. Then all the others just show the relevant lines that would be different for that type of query?

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

Successfully merging this pull request may close these issues.

2 participants