1 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 // use this file except in compliance with the License. You may obtain a copy of 3 // the License at 4 // 5 // http://www.apache.org/licenses/LICENSE-2.0 6 // 7 // Unless required by applicable law or agreed to in writing, software 8 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 // License for the specific language governing permissions and limitations under 11 // the License. 12 13 package driver 14 15 import ( 16 "context" 17 "encoding/json" 18 ) 19 20 // SearchInfo is the result of a [Searcher.SearchInfo] request. 21 type SearchInfo struct { 22 Name string 23 SearchIndex SearchIndex 24 // RawMessage is the raw JSON response returned by the server. 25 RawResponse json.RawMessage 26 } 27 28 // SearchIndex contains textual search index information. 29 type SearchIndex struct { 30 PendingSeq int64 31 DocDelCount int64 32 DocCount int64 33 DiskSize int64 34 CommittedSeq int64 35 } 36 37 // Searcher is an optional interface, which may be satisfied by a [DB] to support 38 // full-text lucene searches, as added in CouchDB 3.0.0. 39 type Searcher interface { 40 // Search performs a full-text search against the specified ddoc and index, 41 // with the specified Lucene query. 42 Search(ctx context.Context, ddoc, index, query string, options map[string]interface{}) (Rows, error) 43 // SearchInfo returns statistics about the specified search index. 44 SearchInfo(ctx context.Context, ddoc, index string) (*SearchInfo, error) 45 // SearchAnalyze tests the results of Lucene analyzer tokenization on sample text. 46 SearchAnalyze(ctx context.Context, text string) ([]string, error) 47 } 48