本站源代码
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

67 rindas
1.4KB

  1. // Copyright (c) 2014 Couchbase, Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package document
  15. type IndexingOptions int
  16. const (
  17. IndexField IndexingOptions = 1 << iota
  18. StoreField
  19. IncludeTermVectors
  20. DocValues
  21. )
  22. func (o IndexingOptions) IsIndexed() bool {
  23. return o&IndexField != 0
  24. }
  25. func (o IndexingOptions) IsStored() bool {
  26. return o&StoreField != 0
  27. }
  28. func (o IndexingOptions) IncludeTermVectors() bool {
  29. return o&IncludeTermVectors != 0
  30. }
  31. func (o IndexingOptions) IncludeDocValues() bool {
  32. return o&DocValues != 0
  33. }
  34. func (o IndexingOptions) String() string {
  35. rv := ""
  36. if o.IsIndexed() {
  37. rv += "INDEXED"
  38. }
  39. if o.IsStored() {
  40. if rv != "" {
  41. rv += ", "
  42. }
  43. rv += "STORE"
  44. }
  45. if o.IncludeTermVectors() {
  46. if rv != "" {
  47. rv += ", "
  48. }
  49. rv += "TV"
  50. }
  51. if o.IncludeDocValues() {
  52. if rv != "" {
  53. rv += ", "
  54. }
  55. rv += "DV"
  56. }
  57. return rv
  58. }
上海开阖软件有限公司 沪ICP备12045867号-1