0
0

Added getters to boost and field query interfaces

This commit is contained in:
slavikm 2016-11-14 14:02:43 -08:00
parent bcaea084c5
commit 339ddbe0fa
11 changed files with 83 additions and 0 deletions

View File

@ -43,6 +43,15 @@ func (q *BoolFieldQuery) SetField(f string) {
q.Field = f q.Field = f
} }
func (q *BoolFieldQuery) GetField() string{
return q.Field
}
func (q *BoolFieldQuery) GetBoost() float64{
return q.Boost.Value()
}
func (q *BoolFieldQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) { func (q *BoolFieldQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) {
field := q.Field field := q.Field
if q.Field == "" { if q.Field == "" {

View File

@ -117,6 +117,14 @@ func (q *DateRangeQuery) SetField(f string) {
q.Field = f q.Field = f
} }
func (q *DateRangeQuery) GetField() string{
return q.Field
}
func (q *DateRangeQuery) GetBoost() float64{
return q.Boost.Value()
}
func (q *DateRangeQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) { func (q *DateRangeQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) {
min, max, err := q.parseEndpoints() min, max, err := q.parseEndpoints()
if err != nil { if err != nil {

View File

@ -52,6 +52,14 @@ func (q *FuzzyQuery) SetField(f string) {
q.Field = f q.Field = f
} }
func (q *FuzzyQuery) GetField() string{
return q.Field
}
func (q *FuzzyQuery) GetBoost() float64{
return q.Boost.Value()
}
func (q *FuzzyQuery) SetFuzziness(f int) { func (q *FuzzyQuery) SetFuzziness(f int) {
q.Fuzziness = f q.Fuzziness = f
} }

View File

@ -94,6 +94,14 @@ func (q *MatchQuery) SetField(f string) {
q.Field = f q.Field = f
} }
func (q *MatchQuery) GetField() string{
return q.Field
}
func (q *MatchQuery) GetBoost() float64{
return q.Boost.Value()
}
func (q *MatchQuery) SetFuzziness(f int) { func (q *MatchQuery) SetFuzziness(f int) {
q.Fuzziness = f q.Fuzziness = f
} }

View File

@ -53,6 +53,14 @@ func (q *MatchPhraseQuery) SetField(f string) {
q.Field = f q.Field = f
} }
func (q *MatchPhraseQuery) GetField() string{
return q.Field
}
func (q *MatchPhraseQuery) GetBoost() float64{
return q.Boost.Value()
}
func (q *MatchPhraseQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) { func (q *MatchPhraseQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) {
field := q.Field field := q.Field
if q.Field == "" { if q.Field == "" {

View File

@ -63,6 +63,14 @@ func (q *NumericRangeQuery) SetField(f string) {
q.Field = f q.Field = f
} }
func (q *NumericRangeQuery) GetField() string{
return q.Field
}
func (q *NumericRangeQuery) GetBoost() float64{
return q.Boost.Value()
}
func (q *NumericRangeQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) { func (q *NumericRangeQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) {
field := q.Field field := q.Field
if q.Field == "" { if q.Field == "" {

View File

@ -45,6 +45,14 @@ func (q *PrefixQuery) SetField(f string) {
q.Field = f q.Field = f
} }
func (q *PrefixQuery) GetField() string{
return q.Field
}
func (q *PrefixQuery) GetBoost() float64{
return q.Boost.Value()
}
func (q *PrefixQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) { func (q *PrefixQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) {
field := q.Field field := q.Field
if q.Field == "" { if q.Field == "" {

View File

@ -44,6 +44,7 @@ type Query interface {
type BoostableQuery interface { type BoostableQuery interface {
Query Query
SetBoost(b float64) SetBoost(b float64)
GetBoost() float64
} }
// A FieldableQuery represents a Query which can be restricted // A FieldableQuery represents a Query which can be restricted
@ -51,6 +52,7 @@ type BoostableQuery interface {
type FieldableQuery interface { type FieldableQuery interface {
Query Query
SetField(f string) SetField(f string)
GetField() string
} }
// A ValidatableQuery represents a Query which can be validated // A ValidatableQuery represents a Query which can be validated

View File

@ -49,6 +49,14 @@ func (q *RegexpQuery) SetField(f string) {
q.Field = f q.Field = f
} }
func (q *RegexpQuery) GetField() string{
return q.Field
}
func (q *RegexpQuery) GetBoost() float64{
return q.Boost.Value()
}
func (q *RegexpQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) { func (q *RegexpQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) {
field := q.Field field := q.Field
if q.Field == "" { if q.Field == "" {

View File

@ -44,6 +44,14 @@ func (q *TermQuery) SetField(f string) {
q.Field = f q.Field = f
} }
func (q *TermQuery) GetField() string{
return q.Field
}
func (q *TermQuery) GetBoost() float64{
return q.Boost.Value()
}
func (q *TermQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) { func (q *TermQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) {
field := q.Field field := q.Field
if q.Field == "" { if q.Field == "" {

View File

@ -70,6 +70,14 @@ func (q *WildcardQuery) SetField(f string) {
q.Field = f q.Field = f
} }
func (q *WildcardQuery) GetField() string{
return q.Field
}
func (q *WildcardQuery) GetBoost() float64{
return q.Boost.Value()
}
func (q *WildcardQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) { func (q *WildcardQuery) Searcher(i index.IndexReader, m mapping.IndexMapping, explain bool) (search.Searcher, error) {
field := q.Field field := q.Field
if q.Field == "" { if q.Field == "" {