aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/blevesearch/bleve/index_impl.go
diff options
context:
space:
mode:
authorEthan Koenig <ethantkoenig@gmail.com>2017-09-16 13:16:21 -0700
committerLauris BH <lauris@nix.lv>2017-09-16 23:16:21 +0300
commitb0f7457d9ef6e16d4a3197f7544035d5d387e201 (patch)
treedbe6a9b3b74f9a4a6eaa0c0cfe59fa08509edccc /vendor/github.com/blevesearch/bleve/index_impl.go
parent52e11b24bf5e395d83ea58c1b0fd6922efe16add (diff)
downloadgitea-b0f7457d9ef6e16d4a3197f7544035d5d387e201.tar.gz
gitea-b0f7457d9ef6e16d4a3197f7544035d5d387e201.zip
Improve issue search (#2387)
* Improve issue indexer * Fix new issue sqlite bug * Different test indexer paths for each db * Add integration indexer paths to make clean
Diffstat (limited to 'vendor/github.com/blevesearch/bleve/index_impl.go')
-rw-r--r--vendor/github.com/blevesearch/bleve/index_impl.go31
1 files changed, 30 insertions, 1 deletions
diff --git a/vendor/github.com/blevesearch/bleve/index_impl.go b/vendor/github.com/blevesearch/bleve/index_impl.go
index 12e0fd3557..799b582a06 100644
--- a/vendor/github.com/blevesearch/bleve/index_impl.go
+++ b/vendor/github.com/blevesearch/bleve/index_impl.go
@@ -253,6 +253,24 @@ func (i *indexImpl) Index(id string, data interface{}) (err error) {
return
}
+// IndexAdvanced takes a document.Document object
+// skips the mapping and indexes it.
+func (i *indexImpl) IndexAdvanced(doc *document.Document) (err error) {
+ if doc.ID == "" {
+ return ErrorEmptyID
+ }
+
+ i.mutex.RLock()
+ defer i.mutex.RUnlock()
+
+ if !i.open {
+ return ErrorIndexClosed
+ }
+
+ err = i.i.Update(doc)
+ return
+}
+
// Delete entries for the specified identifier from
// the index.
func (i *indexImpl) Delete(id string) (err error) {
@@ -370,7 +388,10 @@ func (i *indexImpl) SearchInContext(ctx context.Context, req *SearchRequest) (sr
}
}()
- searcher, err := req.Query.Searcher(indexReader, i.m, req.Explain)
+ searcher, err := req.Query.Searcher(indexReader, i.m, search.SearcherOptions{
+ Explain: req.Explain,
+ IncludeTermVectors: req.IncludeLocations || req.Highlight != nil,
+ })
if err != nil {
return nil, err
}
@@ -461,6 +482,14 @@ func (i *indexImpl) SearchInContext(ctx context.Context, req *SearchRequest) (sr
if err == nil {
value = boolean
}
+ case *document.GeoPointField:
+ lon, err := docF.Lon()
+ if err == nil {
+ lat, err := docF.Lat()
+ if err == nil {
+ value = []float64{lon, lat}
+ }
+ }
}
if value != nil {
hit.AddFieldValue(docF.Name(), value)