├── .gitignore ├── README.md ├── anserini-export-guide.md ├── design-rationale.md ├── pom.xml └── src └── main ├── java └── io │ └── osirrc │ └── ciff │ ├── CommonIndexFileFormat.java │ ├── CommonIndexFileFormatConstants.java │ ├── ReadCIFF.java │ └── lucene │ └── ExportAnseriniLuceneIndex.java ├── protobuf └── CommonIndexFileFormat.proto └── resources ├── cw12b-queries.lucene-analyzed.txt ├── cw12b-tokens.lucene-analyzed.txt ├── robust04-queries.lucene-analyzed.txt └── robust04-tokens.lucene-analyzed.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .DS_Store 3 | target/ 4 | .idea/ 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Common Index File Format 2 | 3 | The Common Index File Format (CIFF) represents an attempt to build a binary data exchange format for open-source search engines to interoperate by sharing index structures. 4 | For more details, check out: 5 | 6 | + Jimmy Lin, Joel Mackenzie, Chris Kamphuis, Craig Macdonald, Antonio Mallia, Michał Siedlaczek, Andrew Trotman, Arjen de Vries. [Supporting Interoperability Between Open-Source Search Engines with the Common Index File Format](https://arxiv.org/abs/2003.08276). _arXiv:2003.08276_. 7 | 8 | All data are contained in a single file, with the extension `.ciff`. 9 | The file comprises a sequence of [delimited](https://developers.google.com/protocol-buffers/docs/techniques) protobuf messages defined [here](src/main/protobuf/CommonIndexFileFormat.proto), exactly as follows: 10 | 11 | + A `Header` 12 | + Exactly the number of `PostingsList` messages specified in the `num_postings_lists` field of the `Header` 13 | + Exactly the number of `DocRecord` messages specified in the `num_docs` field of the `Header` 14 | 15 | See [our design rationale](design-rationale.md) for additional discussion. 16 | 17 | Explained in terms of xkcd, we're trying to avoid [this](https://xkcd.com/927/). 18 | Instead, CIFF aims to be [this](https://xkcd.com/1406/). 19 | 20 | ## Getting Started 21 | 22 | After cloning this repo, build CIFF with Maven: 23 | 24 | ``` 25 | mvn clean package appassembler:assemble 26 | ``` 27 | 28 | ## Reference Lucene Indexes 29 | 30 | Currently, this repo provides an utility to export CIFF from Lucene, via [Anserini](http://anserini.io/). 31 | For reference, we provide exports from the [Robust04](https://github.com/castorini/anserini/blob/master/docs/regressions-robust04.md) and [ClueWeb12-B13](https://github.com/castorini/anserini/blob/master/docs/regressions-cw12b13.md) collections: 32 | 33 | | Collection | Configuration | Size | MD5 | Download | 34 | |:-----------|:--------------|-----:|-----|:---------| 35 | | Robust04 | CIFF export, complete | 162M | `01ce3b9ebfd664b48ffad072fbcae076` | [[Dropbox]](https://www.dropbox.com/s/rph6udiqs2k7bfo/robust04-complete-20200306.ciff.gz?dl=0) | 36 | | Robust04 | CIFF export, queries only | 16M | `0a8ea07b6a262639e44ec959c4f53d44` | [[Dropbox]](https://www.dropbox.com/s/02i308p4fe2bqh6/robust04-queries-20200306.ciff.gz?dl=0) | [[Dropbox]] 37 | | Robust04 | Source Lucene index | 135M | `b993045adb24bcbe292d6ed73d5d47b6` | [[Dropbox]](https://www.dropbox.com/s/omh95m1pe5gwhaj/lucene-index-ciff.robust04.20200306.tar.gz?dl=0) 38 | | ClueWeb12-B13 | CIFF export, complete | 25G | `8fff3a57b9625eca94a286a61062ac82` | [[Dropbox]](https://www.dropbox.com/s/nbxpieqqp5z737h/cw12b-complete-20200309.ciff.gz?dl=0) 39 | | ClueWeb12-B13 | CIFF export, queries only | 1.2G | `45063400bd5823b7f7fec2bc5cbb2d36` | [[Dropbox]](https://www.dropbox.com/s/bx82uwx2mdzm8jy/cw12b-queries-20200309.ciff.gz?dl=0) 40 | | ClueWeb12-B13 | Source Lucene index |21G | `6ad327c9c837787f7d9508462e5aa822` | [[Dropbox]](https://www.dropbox.com/s/33lnfrbvr88b999/lucene-index-ciff.cw12b.20200309.tar.gz?dl=0) 41 | 42 | The follow invocation can be used to examine an export: 43 | 44 | ```bash 45 | target/appassembler/bin/ReadCIFF -input robust04-complete-20200306.ciff.gz 46 | ``` 47 | 48 | We provide a full guide on how to replicate the above results [here](anserini-export-guide.md). 49 | 50 | ## CIFF Importers 51 | 52 | A CIFF export can be ingested into a number of different search systems. 53 | 54 | + [JASSv2](https://github.com/andrewtrotman/JASSv2) via the tool [ciff_to_JASS](https://github.com/andrewtrotman/JASSv2/tree/master/tools). 55 | + [PISA](https://github.com/pisa-engine/pisa) via the [PISA CIFF Binaries](https://github.com/pisa-engine/ciff). 56 | + [OldDog](https://github.com/chriskamphuis/olddog) by [creating csv files through CIFF](https://github.com/Chriskamphuis/olddog/blob/master/src/main/java/nl/ru/convert/CiffToCsv.java) 57 | + [Terrier](http://terrier.org) via the [Terrier-CIFF plugin](https://github.com/terrierteam/terrier-ciff) 58 | 59 | ## Tips for writing your own CIFF Importer / Exporter 60 | 61 | The systems above all provide concrete examples of taking an existing CIFF structure and converting it into a different (internal) index format. 62 | Most of the data/structures within the CIFF are quite straightforward and self-documenting. However, there are a few important details which 63 | should be noted. 64 | 65 | 1. The default CIFF exports come from Anserini. Those exports are engineered to encode document identifiers *as deltas (d-gaps).* Hence, when decoding a CIFF structure, care needs to be taken to recover the original identifiers by computing a prefix sum across each postings list. See the discussion [here](https://github.com/osirrc/ciff/issues/19). 66 | 67 | 2. Since Anserini is based on Lucene, it is important to note that document lengths are encoded in a lossy manner. This means that the document lengths recorded in the `DocRecord` structure are *approximate* - see the discussion [here](https://github.com/osirrc/ciff/issues/21). 68 | 69 | 3. Multiple records are stored in a single file using Java protobuf's parseDelimitedFrom() and writeDelimitedTo() methods. Unfortunately, these methods are not available in the bindings for other languages. These can be trivially reimplemented be reading/writing the bytesize of the record using varint - see the discussion [here](https://github.com/osirrc/ciff/issues/27). 70 | -------------------------------------------------------------------------------- /anserini-export-guide.md: -------------------------------------------------------------------------------- 1 | # Anserini Export Guide 2 | 3 | For replicability, we provide detailed instructions for generating the exports on the main page with [Anserini](http://anserini.io/). 4 | 5 | ## Robust04 6 | 7 | The source index was constructed with the following command, based on [Anserini](http://anserini.io/) v0.7.2 (as tagged in the repo): 8 | 9 | ```bash 10 | sh target/appassembler/bin/IndexCollection -collection ClueWeb12Collection \ 11 | -input /tuna1/collections/web/ClueWeb12-B13/ -index lucene-index-ciff.cw12b.20200309 \ 12 | -generator JsoupGenerator -threads 8 -optimize 13 | ``` 14 | 15 | Note that `-optimize` must be specified to merge the index down to a single segment. 16 | 17 | The follow two invocations created the exports: 18 | 19 | ```bash 20 | target/appassembler/bin/ExportAnseriniLuceneIndex -output robust04-complete-20200306.ciff \ 21 | -index lucene-index-ciff.robust04.20200306 -description "Anserini v0.7.2, Robust04 regression" 22 | 23 | target/appassembler/bin/ExportAnseriniLuceneIndex -index lucene-index-ciff.robust04.20200306 \ 24 | -output robust04-queries-20200306.ciff -termsFile src/main/resources/robust04-tokens.lucene-analyzed.txt \ 25 | -description "Anserini v0.7.2, Robust04 regression" 26 | ``` 27 | 28 | ## ClueWeb12-B13 29 | 30 | The source index was constructed with the following command, based on [Anserini](http://anserini.io/) v0.7.2 (as tagged in the repo): 31 | 32 | ```bash 33 | sh target/appassembler/bin/IndexCollection -collection ClueWeb12Collection \ 34 | -input /tuna1/collections/web/ClueWeb12-B13/ -index lucene-index-ciff.cw12b.20200309 \ 35 | -generator JsoupGenerator -threads 8 -optimize 36 | ``` 37 | 38 | Note that `-optimize` must be specified to merge the index down to a single segment. 39 | 40 | The follow two invocations created the exports: 41 | 42 | ```bash 43 | target/appassembler/bin/ExportAnseriniLuceneIndex -output cw12b-complete-20200309.ciff.gz 44 | -index lucene-index-ciff.cw12b.20200309 -description "Anserini v0.7.2, ClueWeb12-B13 regression" 45 | 46 | target/appassembler/bin/ExportAnseriniLuceneIndex -output cw12b-queries-20200309.ciff.gz \ 47 | -index lucene-index-ciff.cw12b.20200309 -description "Anserini v0.7.2, ClueWeb12-B13 regression" \ 48 | -termsFile src/main/resources/cw12b-tokens.lucene-analyzed.txt \ 49 | ``` 50 | 51 | On a modern desktop with an SSD, the complete export takes a bit less than 3 hours to complete. 52 | The export with queries only takes about 10 minutes. 53 | -------------------------------------------------------------------------------- /design-rationale.md: -------------------------------------------------------------------------------- 1 | # CIFF Design Rationale 2 | 3 | Instead of the design we actually adopted, one might have considered an alternative design comprising of a single protobuf message (e.g., the postings lists and doc records are contained in the header). 4 | In this case, the entire specification of CIFF would be captured in a single protobuf definition. 5 | This design was considered and rejected because it seems to run counter to [best practices suggested by Google](https://developers.google.com/protocol-buffers/docs/techniques): individual protobuf messages shouldn't be that large. 6 | Furthermore, Google's automatically-generated code bindings appear to manipulate individual protobuf messages in memory, which would not be practical in our use case for large collections if the entire index were a single protobuf message. 7 | 8 | Yet another alternative was a separate file for each type of protobuf message, and thus CIFF would be a bundle of files. 9 | Ultimately, we decided on a single-file approach. 10 | 11 | Additional discussion is captured in this [pull request](https://github.com/osirrc/ciff/pull/6). 12 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | io.osricc 4 | ciff 5 | 0.0.1-SNAPSHOT 6 | CIFF 7 | Common Index File Format 8 | https://github.com/osirrc/ 9 | 10 | 11 | 12 | The Apache Software License, Version 2.0 13 | http://www.apache.org/licenses/LICENSE-2.0.txt 14 | repo 15 | 16 | 17 | 18 | 19 | 20 | Jimmy Lin 21 | lintool 22 | jimmylin@uwaterloo.ca 23 | University of Waterloo 24 | https://cs.uwaterloo.ca/~jimmylin/ 25 | 26 | 27 | 28 | 29 | 9.9.0 30 | UTF-8 31 | 32 | 33 | 34 | scm:git:git@github.com:osirrc/ciff.git 35 | scm:git:git@github.com:osirrc/ciff.git 36 | git@github.com:osirrc/ciff.git 37 | HEAD 38 | 39 | 40 | 41 | 42 | public 43 | https://repo1.maven.org/maven2 44 | 45 | 46 | 47 | 48 | 49 | sonatype-nexus-snapshots 50 | Sonatype Nexus Shapshots 51 | https://oss.sonatype.org/content/repositories/snapshots/ 52 | 53 | 54 | sonatype-nexus-staging 55 | https://oss.sonatype.org/service/local/staging/deploy/maven2/ 56 | 57 | 58 | 59 | 60 | 61 | 62 | org.apache.maven.plugins 63 | maven-compiler-plugin 64 | 3.8.1 65 | 66 | 11 67 | 11 68 | 11 69 | 11 70 | true 71 | -Xlint:unchecked 72 | 73 | 74 | 75 | org.codehaus.mojo 76 | appassembler-maven-plugin 77 | 2.0.0 78 | 79 | -Xms512M -Xmx31G 80 | flat 81 | true 82 | 83 | 84 | io.osirrc.ciff.lucene.ExportAnseriniLuceneIndex 85 | ExportAnseriniLuceneIndex 86 | 87 | 88 | io.osirrc.ciff.ReadCIFF 89 | ReadCIFF 90 | 91 | 92 | 93 | 94 | 95 | org.apache.maven.plugins 96 | maven-javadoc-plugin 97 | 3.1.0 98 | 99 | 100 | attach-javadocs 101 | 102 | jar 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | org.apache.maven.plugins 111 | maven-shade-plugin 112 | 3.2.1 113 | 114 | 115 | 117 | package 118 | 119 | shade 120 | 121 | 122 | 124 | 125 | 126 | META-INF/services/org.apache.lucene.codecs.Codec 127 | META-INF/services/org.apache.lucene.codecs.PostingsFormat 128 | 129 | 130 | 132 | 133 | 134 | *:* 135 | 136 | META-INF/*.SF 137 | META-INF/*.DSA 138 | META-INF/*.RSA 139 | 140 | 141 | 142 | 143 | true 144 | fatjar 145 | 146 | 147 | 148 | 149 | 150 | org.apache.maven.plugins 151 | maven-source-plugin 152 | 3.1.0 153 | 154 | 155 | org.apache.maven.plugins 156 | maven-deploy-plugin 157 | 3.0.0-M1 158 | 159 | 160 | org.apache.maven.plugins 161 | maven-release-plugin 162 | 2.5.3 163 | 164 | 165 | org.apache.maven.plugins 166 | maven-gpg-plugin 167 | 1.6 168 | 169 | 170 | sign-artifacts 171 | verify 172 | 173 | sign 174 | 175 | 176 | 177 | 178 | 179 | org.jacoco 180 | jacoco-maven-plugin 181 | 0.8.2 182 | 183 | 184 | 185 | prepare-agent 186 | 187 | 188 | 189 | report 190 | test 191 | 192 | report 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | args4j 203 | args4j 204 | 2.32 205 | jar 206 | 207 | 208 | org.apache.lucene 209 | lucene-core 210 | ${lucene.version} 211 | 212 | 213 | org.apache.lucene 214 | lucene-backward-codecs 215 | ${lucene.version} 216 | 217 | 218 | org.apache.lucene 219 | lucene-test-framework 220 | ${lucene.version} 221 | test 222 | 223 | 224 | junit 225 | junit 226 | 4.12 227 | test 228 | 229 | 230 | com.google.protobuf 231 | protobuf-java 232 | 3.11.4 233 | 234 | 235 | 236 | -------------------------------------------------------------------------------- /src/main/java/io/osirrc/ciff/CommonIndexFileFormat.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: src/main/protobuf/CommonIndexFileFormat.proto 3 | 4 | package io.osirrc.ciff; 5 | 6 | public final class CommonIndexFileFormat { 7 | private CommonIndexFileFormat() {} 8 | public static void registerAllExtensions( 9 | com.google.protobuf.ExtensionRegistryLite registry) { 10 | } 11 | 12 | public static void registerAllExtensions( 13 | com.google.protobuf.ExtensionRegistry registry) { 14 | registerAllExtensions( 15 | (com.google.protobuf.ExtensionRegistryLite) registry); 16 | } 17 | public interface HeaderOrBuilder extends 18 | // @@protoc_insertion_point(interface_extends:io.osirrc.ciff.Header) 19 | com.google.protobuf.MessageOrBuilder { 20 | 21 | /** 22 | *
  23 |      * Version.
  24 |      * 
25 | * 26 | * int32 version = 1; 27 | */ 28 | int getVersion(); 29 | 30 | /** 31 | *
  32 |      * Exactly the number of PostingsList messages that follow the Header.
  33 |      * 
34 | * 35 | * int32 num_postings_lists = 2; 36 | */ 37 | int getNumPostingsLists(); 38 | 39 | /** 40 | *
  41 |      * Exactly the number of DocRecord messages that follow the PostingsList messages.
  42 |      * 
43 | * 44 | * int32 num_docs = 3; 45 | */ 46 | int getNumDocs(); 47 | 48 | /** 49 | *
  50 |      * The total number of postings lists in the collection; the vocabulary size. This might differ from
  51 |      * num_postings_lists, for example, because we only export the postings lists of query terms.
  52 |      * 
53 | * 54 | * int32 total_postings_lists = 4; 55 | */ 56 | int getTotalPostingsLists(); 57 | 58 | /** 59 | *
  60 |      * The total number of documents in the collection; might differ from num_doc_records for a similar reason as above.
  61 |      * 
62 | * 63 | * int32 total_docs = 5; 64 | */ 65 | int getTotalDocs(); 66 | 67 | /** 68 | *
  69 |      * The total number of terms in the entire collection. This is the sum of all document lengths of all documents in
  70 |      * the collection.
  71 |      * 
72 | * 73 | * int64 total_terms_in_collection = 6; 74 | */ 75 | long getTotalTermsInCollection(); 76 | 77 | /** 78 | *
  79 |      * The average document length. We store this value explicitly in case the exporting application wants a particular
  80 |      * level of precision.
  81 |      * 
82 | * 83 | * double average_doclength = 7; 84 | */ 85 | double getAverageDoclength(); 86 | 87 | /** 88 | *
  89 |      * Description of this index, meant for human consumption. Describing, for example, the exporting application,
  90 |      * document processing and tokenization pipeline, etc.
  91 |      * 
92 | * 93 | * string description = 8; 94 | */ 95 | java.lang.String getDescription(); 96 | /** 97 | *
  98 |      * Description of this index, meant for human consumption. Describing, for example, the exporting application,
  99 |      * document processing and tokenization pipeline, etc.
 100 |      * 
101 | * 102 | * string description = 8; 103 | */ 104 | com.google.protobuf.ByteString 105 | getDescriptionBytes(); 106 | } 107 | /** 108 | *
 109 |    * This is the CIFF header. It always comes first.
 110 |    * 
111 | * 112 | * Protobuf type {@code io.osirrc.ciff.Header} 113 | */ 114 | public static final class Header extends 115 | com.google.protobuf.GeneratedMessageV3 implements 116 | // @@protoc_insertion_point(message_implements:io.osirrc.ciff.Header) 117 | HeaderOrBuilder { 118 | private static final long serialVersionUID = 0L; 119 | // Use Header.newBuilder() to construct. 120 | private Header(com.google.protobuf.GeneratedMessageV3.Builder builder) { 121 | super(builder); 122 | } 123 | private Header() { 124 | description_ = ""; 125 | } 126 | 127 | @java.lang.Override 128 | @SuppressWarnings({"unused"}) 129 | protected java.lang.Object newInstance( 130 | UnusedPrivateParameter unused) { 131 | return new Header(); 132 | } 133 | 134 | @java.lang.Override 135 | public final com.google.protobuf.UnknownFieldSet 136 | getUnknownFields() { 137 | return this.unknownFields; 138 | } 139 | private Header( 140 | com.google.protobuf.CodedInputStream input, 141 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 142 | throws com.google.protobuf.InvalidProtocolBufferException { 143 | this(); 144 | if (extensionRegistry == null) { 145 | throw new java.lang.NullPointerException(); 146 | } 147 | com.google.protobuf.UnknownFieldSet.Builder unknownFields = 148 | com.google.protobuf.UnknownFieldSet.newBuilder(); 149 | try { 150 | boolean done = false; 151 | while (!done) { 152 | int tag = input.readTag(); 153 | switch (tag) { 154 | case 0: 155 | done = true; 156 | break; 157 | case 8: { 158 | 159 | version_ = input.readInt32(); 160 | break; 161 | } 162 | case 16: { 163 | 164 | numPostingsLists_ = input.readInt32(); 165 | break; 166 | } 167 | case 24: { 168 | 169 | numDocs_ = input.readInt32(); 170 | break; 171 | } 172 | case 32: { 173 | 174 | totalPostingsLists_ = input.readInt32(); 175 | break; 176 | } 177 | case 40: { 178 | 179 | totalDocs_ = input.readInt32(); 180 | break; 181 | } 182 | case 48: { 183 | 184 | totalTermsInCollection_ = input.readInt64(); 185 | break; 186 | } 187 | case 57: { 188 | 189 | averageDoclength_ = input.readDouble(); 190 | break; 191 | } 192 | case 66: { 193 | java.lang.String s = input.readStringRequireUtf8(); 194 | 195 | description_ = s; 196 | break; 197 | } 198 | default: { 199 | if (!parseUnknownField( 200 | input, unknownFields, extensionRegistry, tag)) { 201 | done = true; 202 | } 203 | break; 204 | } 205 | } 206 | } 207 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 208 | throw e.setUnfinishedMessage(this); 209 | } catch (java.io.IOException e) { 210 | throw new com.google.protobuf.InvalidProtocolBufferException( 211 | e).setUnfinishedMessage(this); 212 | } finally { 213 | this.unknownFields = unknownFields.build(); 214 | makeExtensionsImmutable(); 215 | } 216 | } 217 | public static final com.google.protobuf.Descriptors.Descriptor 218 | getDescriptor() { 219 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_Header_descriptor; 220 | } 221 | 222 | @java.lang.Override 223 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 224 | internalGetFieldAccessorTable() { 225 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_Header_fieldAccessorTable 226 | .ensureFieldAccessorsInitialized( 227 | io.osirrc.ciff.CommonIndexFileFormat.Header.class, io.osirrc.ciff.CommonIndexFileFormat.Header.Builder.class); 228 | } 229 | 230 | public static final int VERSION_FIELD_NUMBER = 1; 231 | private int version_; 232 | /** 233 | *
 234 |      * Version.
 235 |      * 
236 | * 237 | * int32 version = 1; 238 | */ 239 | public int getVersion() { 240 | return version_; 241 | } 242 | 243 | public static final int NUM_POSTINGS_LISTS_FIELD_NUMBER = 2; 244 | private int numPostingsLists_; 245 | /** 246 | *
 247 |      * Exactly the number of PostingsList messages that follow the Header.
 248 |      * 
249 | * 250 | * int32 num_postings_lists = 2; 251 | */ 252 | public int getNumPostingsLists() { 253 | return numPostingsLists_; 254 | } 255 | 256 | public static final int NUM_DOCS_FIELD_NUMBER = 3; 257 | private int numDocs_; 258 | /** 259 | *
 260 |      * Exactly the number of DocRecord messages that follow the PostingsList messages.
 261 |      * 
262 | * 263 | * int32 num_docs = 3; 264 | */ 265 | public int getNumDocs() { 266 | return numDocs_; 267 | } 268 | 269 | public static final int TOTAL_POSTINGS_LISTS_FIELD_NUMBER = 4; 270 | private int totalPostingsLists_; 271 | /** 272 | *
 273 |      * The total number of postings lists in the collection; the vocabulary size. This might differ from
 274 |      * num_postings_lists, for example, because we only export the postings lists of query terms.
 275 |      * 
276 | * 277 | * int32 total_postings_lists = 4; 278 | */ 279 | public int getTotalPostingsLists() { 280 | return totalPostingsLists_; 281 | } 282 | 283 | public static final int TOTAL_DOCS_FIELD_NUMBER = 5; 284 | private int totalDocs_; 285 | /** 286 | *
 287 |      * The total number of documents in the collection; might differ from num_doc_records for a similar reason as above.
 288 |      * 
289 | * 290 | * int32 total_docs = 5; 291 | */ 292 | public int getTotalDocs() { 293 | return totalDocs_; 294 | } 295 | 296 | public static final int TOTAL_TERMS_IN_COLLECTION_FIELD_NUMBER = 6; 297 | private long totalTermsInCollection_; 298 | /** 299 | *
 300 |      * The total number of terms in the entire collection. This is the sum of all document lengths of all documents in
 301 |      * the collection.
 302 |      * 
303 | * 304 | * int64 total_terms_in_collection = 6; 305 | */ 306 | public long getTotalTermsInCollection() { 307 | return totalTermsInCollection_; 308 | } 309 | 310 | public static final int AVERAGE_DOCLENGTH_FIELD_NUMBER = 7; 311 | private double averageDoclength_; 312 | /** 313 | *
 314 |      * The average document length. We store this value explicitly in case the exporting application wants a particular
 315 |      * level of precision.
 316 |      * 
317 | * 318 | * double average_doclength = 7; 319 | */ 320 | public double getAverageDoclength() { 321 | return averageDoclength_; 322 | } 323 | 324 | public static final int DESCRIPTION_FIELD_NUMBER = 8; 325 | private volatile java.lang.Object description_; 326 | /** 327 | *
 328 |      * Description of this index, meant for human consumption. Describing, for example, the exporting application,
 329 |      * document processing and tokenization pipeline, etc.
 330 |      * 
331 | * 332 | * string description = 8; 333 | */ 334 | public java.lang.String getDescription() { 335 | java.lang.Object ref = description_; 336 | if (ref instanceof java.lang.String) { 337 | return (java.lang.String) ref; 338 | } else { 339 | com.google.protobuf.ByteString bs = 340 | (com.google.protobuf.ByteString) ref; 341 | java.lang.String s = bs.toStringUtf8(); 342 | description_ = s; 343 | return s; 344 | } 345 | } 346 | /** 347 | *
 348 |      * Description of this index, meant for human consumption. Describing, for example, the exporting application,
 349 |      * document processing and tokenization pipeline, etc.
 350 |      * 
351 | * 352 | * string description = 8; 353 | */ 354 | public com.google.protobuf.ByteString 355 | getDescriptionBytes() { 356 | java.lang.Object ref = description_; 357 | if (ref instanceof java.lang.String) { 358 | com.google.protobuf.ByteString b = 359 | com.google.protobuf.ByteString.copyFromUtf8( 360 | (java.lang.String) ref); 361 | description_ = b; 362 | return b; 363 | } else { 364 | return (com.google.protobuf.ByteString) ref; 365 | } 366 | } 367 | 368 | private byte memoizedIsInitialized = -1; 369 | @java.lang.Override 370 | public final boolean isInitialized() { 371 | byte isInitialized = memoizedIsInitialized; 372 | if (isInitialized == 1) return true; 373 | if (isInitialized == 0) return false; 374 | 375 | memoizedIsInitialized = 1; 376 | return true; 377 | } 378 | 379 | @java.lang.Override 380 | public void writeTo(com.google.protobuf.CodedOutputStream output) 381 | throws java.io.IOException { 382 | if (version_ != 0) { 383 | output.writeInt32(1, version_); 384 | } 385 | if (numPostingsLists_ != 0) { 386 | output.writeInt32(2, numPostingsLists_); 387 | } 388 | if (numDocs_ != 0) { 389 | output.writeInt32(3, numDocs_); 390 | } 391 | if (totalPostingsLists_ != 0) { 392 | output.writeInt32(4, totalPostingsLists_); 393 | } 394 | if (totalDocs_ != 0) { 395 | output.writeInt32(5, totalDocs_); 396 | } 397 | if (totalTermsInCollection_ != 0L) { 398 | output.writeInt64(6, totalTermsInCollection_); 399 | } 400 | if (averageDoclength_ != 0D) { 401 | output.writeDouble(7, averageDoclength_); 402 | } 403 | if (!getDescriptionBytes().isEmpty()) { 404 | com.google.protobuf.GeneratedMessageV3.writeString(output, 8, description_); 405 | } 406 | unknownFields.writeTo(output); 407 | } 408 | 409 | @java.lang.Override 410 | public int getSerializedSize() { 411 | int size = memoizedSize; 412 | if (size != -1) return size; 413 | 414 | size = 0; 415 | if (version_ != 0) { 416 | size += com.google.protobuf.CodedOutputStream 417 | .computeInt32Size(1, version_); 418 | } 419 | if (numPostingsLists_ != 0) { 420 | size += com.google.protobuf.CodedOutputStream 421 | .computeInt32Size(2, numPostingsLists_); 422 | } 423 | if (numDocs_ != 0) { 424 | size += com.google.protobuf.CodedOutputStream 425 | .computeInt32Size(3, numDocs_); 426 | } 427 | if (totalPostingsLists_ != 0) { 428 | size += com.google.protobuf.CodedOutputStream 429 | .computeInt32Size(4, totalPostingsLists_); 430 | } 431 | if (totalDocs_ != 0) { 432 | size += com.google.protobuf.CodedOutputStream 433 | .computeInt32Size(5, totalDocs_); 434 | } 435 | if (totalTermsInCollection_ != 0L) { 436 | size += com.google.protobuf.CodedOutputStream 437 | .computeInt64Size(6, totalTermsInCollection_); 438 | } 439 | if (averageDoclength_ != 0D) { 440 | size += com.google.protobuf.CodedOutputStream 441 | .computeDoubleSize(7, averageDoclength_); 442 | } 443 | if (!getDescriptionBytes().isEmpty()) { 444 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, description_); 445 | } 446 | size += unknownFields.getSerializedSize(); 447 | memoizedSize = size; 448 | return size; 449 | } 450 | 451 | @java.lang.Override 452 | public boolean equals(final java.lang.Object obj) { 453 | if (obj == this) { 454 | return true; 455 | } 456 | if (!(obj instanceof io.osirrc.ciff.CommonIndexFileFormat.Header)) { 457 | return super.equals(obj); 458 | } 459 | io.osirrc.ciff.CommonIndexFileFormat.Header other = (io.osirrc.ciff.CommonIndexFileFormat.Header) obj; 460 | 461 | if (getVersion() 462 | != other.getVersion()) return false; 463 | if (getNumPostingsLists() 464 | != other.getNumPostingsLists()) return false; 465 | if (getNumDocs() 466 | != other.getNumDocs()) return false; 467 | if (getTotalPostingsLists() 468 | != other.getTotalPostingsLists()) return false; 469 | if (getTotalDocs() 470 | != other.getTotalDocs()) return false; 471 | if (getTotalTermsInCollection() 472 | != other.getTotalTermsInCollection()) return false; 473 | if (java.lang.Double.doubleToLongBits(getAverageDoclength()) 474 | != java.lang.Double.doubleToLongBits( 475 | other.getAverageDoclength())) return false; 476 | if (!getDescription() 477 | .equals(other.getDescription())) return false; 478 | if (!unknownFields.equals(other.unknownFields)) return false; 479 | return true; 480 | } 481 | 482 | @java.lang.Override 483 | public int hashCode() { 484 | if (memoizedHashCode != 0) { 485 | return memoizedHashCode; 486 | } 487 | int hash = 41; 488 | hash = (19 * hash) + getDescriptor().hashCode(); 489 | hash = (37 * hash) + VERSION_FIELD_NUMBER; 490 | hash = (53 * hash) + getVersion(); 491 | hash = (37 * hash) + NUM_POSTINGS_LISTS_FIELD_NUMBER; 492 | hash = (53 * hash) + getNumPostingsLists(); 493 | hash = (37 * hash) + NUM_DOCS_FIELD_NUMBER; 494 | hash = (53 * hash) + getNumDocs(); 495 | hash = (37 * hash) + TOTAL_POSTINGS_LISTS_FIELD_NUMBER; 496 | hash = (53 * hash) + getTotalPostingsLists(); 497 | hash = (37 * hash) + TOTAL_DOCS_FIELD_NUMBER; 498 | hash = (53 * hash) + getTotalDocs(); 499 | hash = (37 * hash) + TOTAL_TERMS_IN_COLLECTION_FIELD_NUMBER; 500 | hash = (53 * hash) + com.google.protobuf.Internal.hashLong( 501 | getTotalTermsInCollection()); 502 | hash = (37 * hash) + AVERAGE_DOCLENGTH_FIELD_NUMBER; 503 | hash = (53 * hash) + com.google.protobuf.Internal.hashLong( 504 | java.lang.Double.doubleToLongBits(getAverageDoclength())); 505 | hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; 506 | hash = (53 * hash) + getDescription().hashCode(); 507 | hash = (29 * hash) + unknownFields.hashCode(); 508 | memoizedHashCode = hash; 509 | return hash; 510 | } 511 | 512 | public static io.osirrc.ciff.CommonIndexFileFormat.Header parseFrom( 513 | java.nio.ByteBuffer data) 514 | throws com.google.protobuf.InvalidProtocolBufferException { 515 | return PARSER.parseFrom(data); 516 | } 517 | public static io.osirrc.ciff.CommonIndexFileFormat.Header parseFrom( 518 | java.nio.ByteBuffer data, 519 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 520 | throws com.google.protobuf.InvalidProtocolBufferException { 521 | return PARSER.parseFrom(data, extensionRegistry); 522 | } 523 | public static io.osirrc.ciff.CommonIndexFileFormat.Header parseFrom( 524 | com.google.protobuf.ByteString data) 525 | throws com.google.protobuf.InvalidProtocolBufferException { 526 | return PARSER.parseFrom(data); 527 | } 528 | public static io.osirrc.ciff.CommonIndexFileFormat.Header parseFrom( 529 | com.google.protobuf.ByteString data, 530 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 531 | throws com.google.protobuf.InvalidProtocolBufferException { 532 | return PARSER.parseFrom(data, extensionRegistry); 533 | } 534 | public static io.osirrc.ciff.CommonIndexFileFormat.Header parseFrom(byte[] data) 535 | throws com.google.protobuf.InvalidProtocolBufferException { 536 | return PARSER.parseFrom(data); 537 | } 538 | public static io.osirrc.ciff.CommonIndexFileFormat.Header parseFrom( 539 | byte[] data, 540 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 541 | throws com.google.protobuf.InvalidProtocolBufferException { 542 | return PARSER.parseFrom(data, extensionRegistry); 543 | } 544 | public static io.osirrc.ciff.CommonIndexFileFormat.Header parseFrom(java.io.InputStream input) 545 | throws java.io.IOException { 546 | return com.google.protobuf.GeneratedMessageV3 547 | .parseWithIOException(PARSER, input); 548 | } 549 | public static io.osirrc.ciff.CommonIndexFileFormat.Header parseFrom( 550 | java.io.InputStream input, 551 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 552 | throws java.io.IOException { 553 | return com.google.protobuf.GeneratedMessageV3 554 | .parseWithIOException(PARSER, input, extensionRegistry); 555 | } 556 | public static io.osirrc.ciff.CommonIndexFileFormat.Header parseDelimitedFrom(java.io.InputStream input) 557 | throws java.io.IOException { 558 | return com.google.protobuf.GeneratedMessageV3 559 | .parseDelimitedWithIOException(PARSER, input); 560 | } 561 | public static io.osirrc.ciff.CommonIndexFileFormat.Header parseDelimitedFrom( 562 | java.io.InputStream input, 563 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 564 | throws java.io.IOException { 565 | return com.google.protobuf.GeneratedMessageV3 566 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry); 567 | } 568 | public static io.osirrc.ciff.CommonIndexFileFormat.Header parseFrom( 569 | com.google.protobuf.CodedInputStream input) 570 | throws java.io.IOException { 571 | return com.google.protobuf.GeneratedMessageV3 572 | .parseWithIOException(PARSER, input); 573 | } 574 | public static io.osirrc.ciff.CommonIndexFileFormat.Header parseFrom( 575 | com.google.protobuf.CodedInputStream input, 576 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 577 | throws java.io.IOException { 578 | return com.google.protobuf.GeneratedMessageV3 579 | .parseWithIOException(PARSER, input, extensionRegistry); 580 | } 581 | 582 | @java.lang.Override 583 | public Builder newBuilderForType() { return newBuilder(); } 584 | public static Builder newBuilder() { 585 | return DEFAULT_INSTANCE.toBuilder(); 586 | } 587 | public static Builder newBuilder(io.osirrc.ciff.CommonIndexFileFormat.Header prototype) { 588 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 589 | } 590 | @java.lang.Override 591 | public Builder toBuilder() { 592 | return this == DEFAULT_INSTANCE 593 | ? new Builder() : new Builder().mergeFrom(this); 594 | } 595 | 596 | @java.lang.Override 597 | protected Builder newBuilderForType( 598 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 599 | Builder builder = new Builder(parent); 600 | return builder; 601 | } 602 | /** 603 | *
 604 |      * This is the CIFF header. It always comes first.
 605 |      * 
606 | * 607 | * Protobuf type {@code io.osirrc.ciff.Header} 608 | */ 609 | public static final class Builder extends 610 | com.google.protobuf.GeneratedMessageV3.Builder implements 611 | // @@protoc_insertion_point(builder_implements:io.osirrc.ciff.Header) 612 | io.osirrc.ciff.CommonIndexFileFormat.HeaderOrBuilder { 613 | public static final com.google.protobuf.Descriptors.Descriptor 614 | getDescriptor() { 615 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_Header_descriptor; 616 | } 617 | 618 | @java.lang.Override 619 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 620 | internalGetFieldAccessorTable() { 621 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_Header_fieldAccessorTable 622 | .ensureFieldAccessorsInitialized( 623 | io.osirrc.ciff.CommonIndexFileFormat.Header.class, io.osirrc.ciff.CommonIndexFileFormat.Header.Builder.class); 624 | } 625 | 626 | // Construct using io.osirrc.ciff.CommonIndexFileFormat.Header.newBuilder() 627 | private Builder() { 628 | maybeForceBuilderInitialization(); 629 | } 630 | 631 | private Builder( 632 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 633 | super(parent); 634 | maybeForceBuilderInitialization(); 635 | } 636 | private void maybeForceBuilderInitialization() { 637 | if (com.google.protobuf.GeneratedMessageV3 638 | .alwaysUseFieldBuilders) { 639 | } 640 | } 641 | @java.lang.Override 642 | public Builder clear() { 643 | super.clear(); 644 | version_ = 0; 645 | 646 | numPostingsLists_ = 0; 647 | 648 | numDocs_ = 0; 649 | 650 | totalPostingsLists_ = 0; 651 | 652 | totalDocs_ = 0; 653 | 654 | totalTermsInCollection_ = 0L; 655 | 656 | averageDoclength_ = 0D; 657 | 658 | description_ = ""; 659 | 660 | return this; 661 | } 662 | 663 | @java.lang.Override 664 | public com.google.protobuf.Descriptors.Descriptor 665 | getDescriptorForType() { 666 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_Header_descriptor; 667 | } 668 | 669 | @java.lang.Override 670 | public io.osirrc.ciff.CommonIndexFileFormat.Header getDefaultInstanceForType() { 671 | return io.osirrc.ciff.CommonIndexFileFormat.Header.getDefaultInstance(); 672 | } 673 | 674 | @java.lang.Override 675 | public io.osirrc.ciff.CommonIndexFileFormat.Header build() { 676 | io.osirrc.ciff.CommonIndexFileFormat.Header result = buildPartial(); 677 | if (!result.isInitialized()) { 678 | throw newUninitializedMessageException(result); 679 | } 680 | return result; 681 | } 682 | 683 | @java.lang.Override 684 | public io.osirrc.ciff.CommonIndexFileFormat.Header buildPartial() { 685 | io.osirrc.ciff.CommonIndexFileFormat.Header result = new io.osirrc.ciff.CommonIndexFileFormat.Header(this); 686 | result.version_ = version_; 687 | result.numPostingsLists_ = numPostingsLists_; 688 | result.numDocs_ = numDocs_; 689 | result.totalPostingsLists_ = totalPostingsLists_; 690 | result.totalDocs_ = totalDocs_; 691 | result.totalTermsInCollection_ = totalTermsInCollection_; 692 | result.averageDoclength_ = averageDoclength_; 693 | result.description_ = description_; 694 | onBuilt(); 695 | return result; 696 | } 697 | 698 | @java.lang.Override 699 | public Builder clone() { 700 | return super.clone(); 701 | } 702 | @java.lang.Override 703 | public Builder setField( 704 | com.google.protobuf.Descriptors.FieldDescriptor field, 705 | java.lang.Object value) { 706 | return super.setField(field, value); 707 | } 708 | @java.lang.Override 709 | public Builder clearField( 710 | com.google.protobuf.Descriptors.FieldDescriptor field) { 711 | return super.clearField(field); 712 | } 713 | @java.lang.Override 714 | public Builder clearOneof( 715 | com.google.protobuf.Descriptors.OneofDescriptor oneof) { 716 | return super.clearOneof(oneof); 717 | } 718 | @java.lang.Override 719 | public Builder setRepeatedField( 720 | com.google.protobuf.Descriptors.FieldDescriptor field, 721 | int index, java.lang.Object value) { 722 | return super.setRepeatedField(field, index, value); 723 | } 724 | @java.lang.Override 725 | public Builder addRepeatedField( 726 | com.google.protobuf.Descriptors.FieldDescriptor field, 727 | java.lang.Object value) { 728 | return super.addRepeatedField(field, value); 729 | } 730 | @java.lang.Override 731 | public Builder mergeFrom(com.google.protobuf.Message other) { 732 | if (other instanceof io.osirrc.ciff.CommonIndexFileFormat.Header) { 733 | return mergeFrom((io.osirrc.ciff.CommonIndexFileFormat.Header)other); 734 | } else { 735 | super.mergeFrom(other); 736 | return this; 737 | } 738 | } 739 | 740 | public Builder mergeFrom(io.osirrc.ciff.CommonIndexFileFormat.Header other) { 741 | if (other == io.osirrc.ciff.CommonIndexFileFormat.Header.getDefaultInstance()) return this; 742 | if (other.getVersion() != 0) { 743 | setVersion(other.getVersion()); 744 | } 745 | if (other.getNumPostingsLists() != 0) { 746 | setNumPostingsLists(other.getNumPostingsLists()); 747 | } 748 | if (other.getNumDocs() != 0) { 749 | setNumDocs(other.getNumDocs()); 750 | } 751 | if (other.getTotalPostingsLists() != 0) { 752 | setTotalPostingsLists(other.getTotalPostingsLists()); 753 | } 754 | if (other.getTotalDocs() != 0) { 755 | setTotalDocs(other.getTotalDocs()); 756 | } 757 | if (other.getTotalTermsInCollection() != 0L) { 758 | setTotalTermsInCollection(other.getTotalTermsInCollection()); 759 | } 760 | if (other.getAverageDoclength() != 0D) { 761 | setAverageDoclength(other.getAverageDoclength()); 762 | } 763 | if (!other.getDescription().isEmpty()) { 764 | description_ = other.description_; 765 | onChanged(); 766 | } 767 | this.mergeUnknownFields(other.unknownFields); 768 | onChanged(); 769 | return this; 770 | } 771 | 772 | @java.lang.Override 773 | public final boolean isInitialized() { 774 | return true; 775 | } 776 | 777 | @java.lang.Override 778 | public Builder mergeFrom( 779 | com.google.protobuf.CodedInputStream input, 780 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 781 | throws java.io.IOException { 782 | io.osirrc.ciff.CommonIndexFileFormat.Header parsedMessage = null; 783 | try { 784 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); 785 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 786 | parsedMessage = (io.osirrc.ciff.CommonIndexFileFormat.Header) e.getUnfinishedMessage(); 787 | throw e.unwrapIOException(); 788 | } finally { 789 | if (parsedMessage != null) { 790 | mergeFrom(parsedMessage); 791 | } 792 | } 793 | return this; 794 | } 795 | 796 | private int version_ ; 797 | /** 798 | *
 799 |        * Version.
 800 |        * 
801 | * 802 | * int32 version = 1; 803 | */ 804 | public int getVersion() { 805 | return version_; 806 | } 807 | /** 808 | *
 809 |        * Version.
 810 |        * 
811 | * 812 | * int32 version = 1; 813 | */ 814 | public Builder setVersion(int value) { 815 | 816 | version_ = value; 817 | onChanged(); 818 | return this; 819 | } 820 | /** 821 | *
 822 |        * Version.
 823 |        * 
824 | * 825 | * int32 version = 1; 826 | */ 827 | public Builder clearVersion() { 828 | 829 | version_ = 0; 830 | onChanged(); 831 | return this; 832 | } 833 | 834 | private int numPostingsLists_ ; 835 | /** 836 | *
 837 |        * Exactly the number of PostingsList messages that follow the Header.
 838 |        * 
839 | * 840 | * int32 num_postings_lists = 2; 841 | */ 842 | public int getNumPostingsLists() { 843 | return numPostingsLists_; 844 | } 845 | /** 846 | *
 847 |        * Exactly the number of PostingsList messages that follow the Header.
 848 |        * 
849 | * 850 | * int32 num_postings_lists = 2; 851 | */ 852 | public Builder setNumPostingsLists(int value) { 853 | 854 | numPostingsLists_ = value; 855 | onChanged(); 856 | return this; 857 | } 858 | /** 859 | *
 860 |        * Exactly the number of PostingsList messages that follow the Header.
 861 |        * 
862 | * 863 | * int32 num_postings_lists = 2; 864 | */ 865 | public Builder clearNumPostingsLists() { 866 | 867 | numPostingsLists_ = 0; 868 | onChanged(); 869 | return this; 870 | } 871 | 872 | private int numDocs_ ; 873 | /** 874 | *
 875 |        * Exactly the number of DocRecord messages that follow the PostingsList messages.
 876 |        * 
877 | * 878 | * int32 num_docs = 3; 879 | */ 880 | public int getNumDocs() { 881 | return numDocs_; 882 | } 883 | /** 884 | *
 885 |        * Exactly the number of DocRecord messages that follow the PostingsList messages.
 886 |        * 
887 | * 888 | * int32 num_docs = 3; 889 | */ 890 | public Builder setNumDocs(int value) { 891 | 892 | numDocs_ = value; 893 | onChanged(); 894 | return this; 895 | } 896 | /** 897 | *
 898 |        * Exactly the number of DocRecord messages that follow the PostingsList messages.
 899 |        * 
900 | * 901 | * int32 num_docs = 3; 902 | */ 903 | public Builder clearNumDocs() { 904 | 905 | numDocs_ = 0; 906 | onChanged(); 907 | return this; 908 | } 909 | 910 | private int totalPostingsLists_ ; 911 | /** 912 | *
 913 |        * The total number of postings lists in the collection; the vocabulary size. This might differ from
 914 |        * num_postings_lists, for example, because we only export the postings lists of query terms.
 915 |        * 
916 | * 917 | * int32 total_postings_lists = 4; 918 | */ 919 | public int getTotalPostingsLists() { 920 | return totalPostingsLists_; 921 | } 922 | /** 923 | *
 924 |        * The total number of postings lists in the collection; the vocabulary size. This might differ from
 925 |        * num_postings_lists, for example, because we only export the postings lists of query terms.
 926 |        * 
927 | * 928 | * int32 total_postings_lists = 4; 929 | */ 930 | public Builder setTotalPostingsLists(int value) { 931 | 932 | totalPostingsLists_ = value; 933 | onChanged(); 934 | return this; 935 | } 936 | /** 937 | *
 938 |        * The total number of postings lists in the collection; the vocabulary size. This might differ from
 939 |        * num_postings_lists, for example, because we only export the postings lists of query terms.
 940 |        * 
941 | * 942 | * int32 total_postings_lists = 4; 943 | */ 944 | public Builder clearTotalPostingsLists() { 945 | 946 | totalPostingsLists_ = 0; 947 | onChanged(); 948 | return this; 949 | } 950 | 951 | private int totalDocs_ ; 952 | /** 953 | *
 954 |        * The total number of documents in the collection; might differ from num_doc_records for a similar reason as above.
 955 |        * 
956 | * 957 | * int32 total_docs = 5; 958 | */ 959 | public int getTotalDocs() { 960 | return totalDocs_; 961 | } 962 | /** 963 | *
 964 |        * The total number of documents in the collection; might differ from num_doc_records for a similar reason as above.
 965 |        * 
966 | * 967 | * int32 total_docs = 5; 968 | */ 969 | public Builder setTotalDocs(int value) { 970 | 971 | totalDocs_ = value; 972 | onChanged(); 973 | return this; 974 | } 975 | /** 976 | *
 977 |        * The total number of documents in the collection; might differ from num_doc_records for a similar reason as above.
 978 |        * 
979 | * 980 | * int32 total_docs = 5; 981 | */ 982 | public Builder clearTotalDocs() { 983 | 984 | totalDocs_ = 0; 985 | onChanged(); 986 | return this; 987 | } 988 | 989 | private long totalTermsInCollection_ ; 990 | /** 991 | *
 992 |        * The total number of terms in the entire collection. This is the sum of all document lengths of all documents in
 993 |        * the collection.
 994 |        * 
995 | * 996 | * int64 total_terms_in_collection = 6; 997 | */ 998 | public long getTotalTermsInCollection() { 999 | return totalTermsInCollection_; 1000 | } 1001 | /** 1002 | *
1003 |        * The total number of terms in the entire collection. This is the sum of all document lengths of all documents in
1004 |        * the collection.
1005 |        * 
1006 | * 1007 | * int64 total_terms_in_collection = 6; 1008 | */ 1009 | public Builder setTotalTermsInCollection(long value) { 1010 | 1011 | totalTermsInCollection_ = value; 1012 | onChanged(); 1013 | return this; 1014 | } 1015 | /** 1016 | *
1017 |        * The total number of terms in the entire collection. This is the sum of all document lengths of all documents in
1018 |        * the collection.
1019 |        * 
1020 | * 1021 | * int64 total_terms_in_collection = 6; 1022 | */ 1023 | public Builder clearTotalTermsInCollection() { 1024 | 1025 | totalTermsInCollection_ = 0L; 1026 | onChanged(); 1027 | return this; 1028 | } 1029 | 1030 | private double averageDoclength_ ; 1031 | /** 1032 | *
1033 |        * The average document length. We store this value explicitly in case the exporting application wants a particular
1034 |        * level of precision.
1035 |        * 
1036 | * 1037 | * double average_doclength = 7; 1038 | */ 1039 | public double getAverageDoclength() { 1040 | return averageDoclength_; 1041 | } 1042 | /** 1043 | *
1044 |        * The average document length. We store this value explicitly in case the exporting application wants a particular
1045 |        * level of precision.
1046 |        * 
1047 | * 1048 | * double average_doclength = 7; 1049 | */ 1050 | public Builder setAverageDoclength(double value) { 1051 | 1052 | averageDoclength_ = value; 1053 | onChanged(); 1054 | return this; 1055 | } 1056 | /** 1057 | *
1058 |        * The average document length. We store this value explicitly in case the exporting application wants a particular
1059 |        * level of precision.
1060 |        * 
1061 | * 1062 | * double average_doclength = 7; 1063 | */ 1064 | public Builder clearAverageDoclength() { 1065 | 1066 | averageDoclength_ = 0D; 1067 | onChanged(); 1068 | return this; 1069 | } 1070 | 1071 | private java.lang.Object description_ = ""; 1072 | /** 1073 | *
1074 |        * Description of this index, meant for human consumption. Describing, for example, the exporting application,
1075 |        * document processing and tokenization pipeline, etc.
1076 |        * 
1077 | * 1078 | * string description = 8; 1079 | */ 1080 | public java.lang.String getDescription() { 1081 | java.lang.Object ref = description_; 1082 | if (!(ref instanceof java.lang.String)) { 1083 | com.google.protobuf.ByteString bs = 1084 | (com.google.protobuf.ByteString) ref; 1085 | java.lang.String s = bs.toStringUtf8(); 1086 | description_ = s; 1087 | return s; 1088 | } else { 1089 | return (java.lang.String) ref; 1090 | } 1091 | } 1092 | /** 1093 | *
1094 |        * Description of this index, meant for human consumption. Describing, for example, the exporting application,
1095 |        * document processing and tokenization pipeline, etc.
1096 |        * 
1097 | * 1098 | * string description = 8; 1099 | */ 1100 | public com.google.protobuf.ByteString 1101 | getDescriptionBytes() { 1102 | java.lang.Object ref = description_; 1103 | if (ref instanceof String) { 1104 | com.google.protobuf.ByteString b = 1105 | com.google.protobuf.ByteString.copyFromUtf8( 1106 | (java.lang.String) ref); 1107 | description_ = b; 1108 | return b; 1109 | } else { 1110 | return (com.google.protobuf.ByteString) ref; 1111 | } 1112 | } 1113 | /** 1114 | *
1115 |        * Description of this index, meant for human consumption. Describing, for example, the exporting application,
1116 |        * document processing and tokenization pipeline, etc.
1117 |        * 
1118 | * 1119 | * string description = 8; 1120 | */ 1121 | public Builder setDescription( 1122 | java.lang.String value) { 1123 | if (value == null) { 1124 | throw new NullPointerException(); 1125 | } 1126 | 1127 | description_ = value; 1128 | onChanged(); 1129 | return this; 1130 | } 1131 | /** 1132 | *
1133 |        * Description of this index, meant for human consumption. Describing, for example, the exporting application,
1134 |        * document processing and tokenization pipeline, etc.
1135 |        * 
1136 | * 1137 | * string description = 8; 1138 | */ 1139 | public Builder clearDescription() { 1140 | 1141 | description_ = getDefaultInstance().getDescription(); 1142 | onChanged(); 1143 | return this; 1144 | } 1145 | /** 1146 | *
1147 |        * Description of this index, meant for human consumption. Describing, for example, the exporting application,
1148 |        * document processing and tokenization pipeline, etc.
1149 |        * 
1150 | * 1151 | * string description = 8; 1152 | */ 1153 | public Builder setDescriptionBytes( 1154 | com.google.protobuf.ByteString value) { 1155 | if (value == null) { 1156 | throw new NullPointerException(); 1157 | } 1158 | checkByteStringIsUtf8(value); 1159 | 1160 | description_ = value; 1161 | onChanged(); 1162 | return this; 1163 | } 1164 | @java.lang.Override 1165 | public final Builder setUnknownFields( 1166 | final com.google.protobuf.UnknownFieldSet unknownFields) { 1167 | return super.setUnknownFields(unknownFields); 1168 | } 1169 | 1170 | @java.lang.Override 1171 | public final Builder mergeUnknownFields( 1172 | final com.google.protobuf.UnknownFieldSet unknownFields) { 1173 | return super.mergeUnknownFields(unknownFields); 1174 | } 1175 | 1176 | 1177 | // @@protoc_insertion_point(builder_scope:io.osirrc.ciff.Header) 1178 | } 1179 | 1180 | // @@protoc_insertion_point(class_scope:io.osirrc.ciff.Header) 1181 | private static final io.osirrc.ciff.CommonIndexFileFormat.Header DEFAULT_INSTANCE; 1182 | static { 1183 | DEFAULT_INSTANCE = new io.osirrc.ciff.CommonIndexFileFormat.Header(); 1184 | } 1185 | 1186 | public static io.osirrc.ciff.CommonIndexFileFormat.Header getDefaultInstance() { 1187 | return DEFAULT_INSTANCE; 1188 | } 1189 | 1190 | private static final com.google.protobuf.Parser
1191 | PARSER = new com.google.protobuf.AbstractParser
() { 1192 | @java.lang.Override 1193 | public Header parsePartialFrom( 1194 | com.google.protobuf.CodedInputStream input, 1195 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1196 | throws com.google.protobuf.InvalidProtocolBufferException { 1197 | return new Header(input, extensionRegistry); 1198 | } 1199 | }; 1200 | 1201 | public static com.google.protobuf.Parser
parser() { 1202 | return PARSER; 1203 | } 1204 | 1205 | @java.lang.Override 1206 | public com.google.protobuf.Parser
getParserForType() { 1207 | return PARSER; 1208 | } 1209 | 1210 | @java.lang.Override 1211 | public io.osirrc.ciff.CommonIndexFileFormat.Header getDefaultInstanceForType() { 1212 | return DEFAULT_INSTANCE; 1213 | } 1214 | 1215 | } 1216 | 1217 | public interface PostingOrBuilder extends 1218 | // @@protoc_insertion_point(interface_extends:io.osirrc.ciff.Posting) 1219 | com.google.protobuf.MessageOrBuilder { 1220 | 1221 | /** 1222 | * int32 docid = 1; 1223 | */ 1224 | int getDocid(); 1225 | 1226 | /** 1227 | * int32 tf = 2; 1228 | */ 1229 | int getTf(); 1230 | } 1231 | /** 1232 | *
1233 |    * An individual posting.
1234 |    * 
1235 | * 1236 | * Protobuf type {@code io.osirrc.ciff.Posting} 1237 | */ 1238 | public static final class Posting extends 1239 | com.google.protobuf.GeneratedMessageV3 implements 1240 | // @@protoc_insertion_point(message_implements:io.osirrc.ciff.Posting) 1241 | PostingOrBuilder { 1242 | private static final long serialVersionUID = 0L; 1243 | // Use Posting.newBuilder() to construct. 1244 | private Posting(com.google.protobuf.GeneratedMessageV3.Builder builder) { 1245 | super(builder); 1246 | } 1247 | private Posting() { 1248 | } 1249 | 1250 | @java.lang.Override 1251 | @SuppressWarnings({"unused"}) 1252 | protected java.lang.Object newInstance( 1253 | UnusedPrivateParameter unused) { 1254 | return new Posting(); 1255 | } 1256 | 1257 | @java.lang.Override 1258 | public final com.google.protobuf.UnknownFieldSet 1259 | getUnknownFields() { 1260 | return this.unknownFields; 1261 | } 1262 | private Posting( 1263 | com.google.protobuf.CodedInputStream input, 1264 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1265 | throws com.google.protobuf.InvalidProtocolBufferException { 1266 | this(); 1267 | if (extensionRegistry == null) { 1268 | throw new java.lang.NullPointerException(); 1269 | } 1270 | com.google.protobuf.UnknownFieldSet.Builder unknownFields = 1271 | com.google.protobuf.UnknownFieldSet.newBuilder(); 1272 | try { 1273 | boolean done = false; 1274 | while (!done) { 1275 | int tag = input.readTag(); 1276 | switch (tag) { 1277 | case 0: 1278 | done = true; 1279 | break; 1280 | case 8: { 1281 | 1282 | docid_ = input.readInt32(); 1283 | break; 1284 | } 1285 | case 16: { 1286 | 1287 | tf_ = input.readInt32(); 1288 | break; 1289 | } 1290 | default: { 1291 | if (!parseUnknownField( 1292 | input, unknownFields, extensionRegistry, tag)) { 1293 | done = true; 1294 | } 1295 | break; 1296 | } 1297 | } 1298 | } 1299 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1300 | throw e.setUnfinishedMessage(this); 1301 | } catch (java.io.IOException e) { 1302 | throw new com.google.protobuf.InvalidProtocolBufferException( 1303 | e).setUnfinishedMessage(this); 1304 | } finally { 1305 | this.unknownFields = unknownFields.build(); 1306 | makeExtensionsImmutable(); 1307 | } 1308 | } 1309 | public static final com.google.protobuf.Descriptors.Descriptor 1310 | getDescriptor() { 1311 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_Posting_descriptor; 1312 | } 1313 | 1314 | @java.lang.Override 1315 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 1316 | internalGetFieldAccessorTable() { 1317 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_Posting_fieldAccessorTable 1318 | .ensureFieldAccessorsInitialized( 1319 | io.osirrc.ciff.CommonIndexFileFormat.Posting.class, io.osirrc.ciff.CommonIndexFileFormat.Posting.Builder.class); 1320 | } 1321 | 1322 | public static final int DOCID_FIELD_NUMBER = 1; 1323 | private int docid_; 1324 | /** 1325 | * int32 docid = 1; 1326 | */ 1327 | public int getDocid() { 1328 | return docid_; 1329 | } 1330 | 1331 | public static final int TF_FIELD_NUMBER = 2; 1332 | private int tf_; 1333 | /** 1334 | * int32 tf = 2; 1335 | */ 1336 | public int getTf() { 1337 | return tf_; 1338 | } 1339 | 1340 | private byte memoizedIsInitialized = -1; 1341 | @java.lang.Override 1342 | public final boolean isInitialized() { 1343 | byte isInitialized = memoizedIsInitialized; 1344 | if (isInitialized == 1) return true; 1345 | if (isInitialized == 0) return false; 1346 | 1347 | memoizedIsInitialized = 1; 1348 | return true; 1349 | } 1350 | 1351 | @java.lang.Override 1352 | public void writeTo(com.google.protobuf.CodedOutputStream output) 1353 | throws java.io.IOException { 1354 | if (docid_ != 0) { 1355 | output.writeInt32(1, docid_); 1356 | } 1357 | if (tf_ != 0) { 1358 | output.writeInt32(2, tf_); 1359 | } 1360 | unknownFields.writeTo(output); 1361 | } 1362 | 1363 | @java.lang.Override 1364 | public int getSerializedSize() { 1365 | int size = memoizedSize; 1366 | if (size != -1) return size; 1367 | 1368 | size = 0; 1369 | if (docid_ != 0) { 1370 | size += com.google.protobuf.CodedOutputStream 1371 | .computeInt32Size(1, docid_); 1372 | } 1373 | if (tf_ != 0) { 1374 | size += com.google.protobuf.CodedOutputStream 1375 | .computeInt32Size(2, tf_); 1376 | } 1377 | size += unknownFields.getSerializedSize(); 1378 | memoizedSize = size; 1379 | return size; 1380 | } 1381 | 1382 | @java.lang.Override 1383 | public boolean equals(final java.lang.Object obj) { 1384 | if (obj == this) { 1385 | return true; 1386 | } 1387 | if (!(obj instanceof io.osirrc.ciff.CommonIndexFileFormat.Posting)) { 1388 | return super.equals(obj); 1389 | } 1390 | io.osirrc.ciff.CommonIndexFileFormat.Posting other = (io.osirrc.ciff.CommonIndexFileFormat.Posting) obj; 1391 | 1392 | if (getDocid() 1393 | != other.getDocid()) return false; 1394 | if (getTf() 1395 | != other.getTf()) return false; 1396 | if (!unknownFields.equals(other.unknownFields)) return false; 1397 | return true; 1398 | } 1399 | 1400 | @java.lang.Override 1401 | public int hashCode() { 1402 | if (memoizedHashCode != 0) { 1403 | return memoizedHashCode; 1404 | } 1405 | int hash = 41; 1406 | hash = (19 * hash) + getDescriptor().hashCode(); 1407 | hash = (37 * hash) + DOCID_FIELD_NUMBER; 1408 | hash = (53 * hash) + getDocid(); 1409 | hash = (37 * hash) + TF_FIELD_NUMBER; 1410 | hash = (53 * hash) + getTf(); 1411 | hash = (29 * hash) + unknownFields.hashCode(); 1412 | memoizedHashCode = hash; 1413 | return hash; 1414 | } 1415 | 1416 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting parseFrom( 1417 | java.nio.ByteBuffer data) 1418 | throws com.google.protobuf.InvalidProtocolBufferException { 1419 | return PARSER.parseFrom(data); 1420 | } 1421 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting parseFrom( 1422 | java.nio.ByteBuffer data, 1423 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1424 | throws com.google.protobuf.InvalidProtocolBufferException { 1425 | return PARSER.parseFrom(data, extensionRegistry); 1426 | } 1427 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting parseFrom( 1428 | com.google.protobuf.ByteString data) 1429 | throws com.google.protobuf.InvalidProtocolBufferException { 1430 | return PARSER.parseFrom(data); 1431 | } 1432 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting parseFrom( 1433 | com.google.protobuf.ByteString data, 1434 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1435 | throws com.google.protobuf.InvalidProtocolBufferException { 1436 | return PARSER.parseFrom(data, extensionRegistry); 1437 | } 1438 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting parseFrom(byte[] data) 1439 | throws com.google.protobuf.InvalidProtocolBufferException { 1440 | return PARSER.parseFrom(data); 1441 | } 1442 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting parseFrom( 1443 | byte[] data, 1444 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1445 | throws com.google.protobuf.InvalidProtocolBufferException { 1446 | return PARSER.parseFrom(data, extensionRegistry); 1447 | } 1448 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting parseFrom(java.io.InputStream input) 1449 | throws java.io.IOException { 1450 | return com.google.protobuf.GeneratedMessageV3 1451 | .parseWithIOException(PARSER, input); 1452 | } 1453 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting parseFrom( 1454 | java.io.InputStream input, 1455 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1456 | throws java.io.IOException { 1457 | return com.google.protobuf.GeneratedMessageV3 1458 | .parseWithIOException(PARSER, input, extensionRegistry); 1459 | } 1460 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting parseDelimitedFrom(java.io.InputStream input) 1461 | throws java.io.IOException { 1462 | return com.google.protobuf.GeneratedMessageV3 1463 | .parseDelimitedWithIOException(PARSER, input); 1464 | } 1465 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting parseDelimitedFrom( 1466 | java.io.InputStream input, 1467 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1468 | throws java.io.IOException { 1469 | return com.google.protobuf.GeneratedMessageV3 1470 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry); 1471 | } 1472 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting parseFrom( 1473 | com.google.protobuf.CodedInputStream input) 1474 | throws java.io.IOException { 1475 | return com.google.protobuf.GeneratedMessageV3 1476 | .parseWithIOException(PARSER, input); 1477 | } 1478 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting parseFrom( 1479 | com.google.protobuf.CodedInputStream input, 1480 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1481 | throws java.io.IOException { 1482 | return com.google.protobuf.GeneratedMessageV3 1483 | .parseWithIOException(PARSER, input, extensionRegistry); 1484 | } 1485 | 1486 | @java.lang.Override 1487 | public Builder newBuilderForType() { return newBuilder(); } 1488 | public static Builder newBuilder() { 1489 | return DEFAULT_INSTANCE.toBuilder(); 1490 | } 1491 | public static Builder newBuilder(io.osirrc.ciff.CommonIndexFileFormat.Posting prototype) { 1492 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 1493 | } 1494 | @java.lang.Override 1495 | public Builder toBuilder() { 1496 | return this == DEFAULT_INSTANCE 1497 | ? new Builder() : new Builder().mergeFrom(this); 1498 | } 1499 | 1500 | @java.lang.Override 1501 | protected Builder newBuilderForType( 1502 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 1503 | Builder builder = new Builder(parent); 1504 | return builder; 1505 | } 1506 | /** 1507 | *
1508 |      * An individual posting.
1509 |      * 
1510 | * 1511 | * Protobuf type {@code io.osirrc.ciff.Posting} 1512 | */ 1513 | public static final class Builder extends 1514 | com.google.protobuf.GeneratedMessageV3.Builder implements 1515 | // @@protoc_insertion_point(builder_implements:io.osirrc.ciff.Posting) 1516 | io.osirrc.ciff.CommonIndexFileFormat.PostingOrBuilder { 1517 | public static final com.google.protobuf.Descriptors.Descriptor 1518 | getDescriptor() { 1519 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_Posting_descriptor; 1520 | } 1521 | 1522 | @java.lang.Override 1523 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 1524 | internalGetFieldAccessorTable() { 1525 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_Posting_fieldAccessorTable 1526 | .ensureFieldAccessorsInitialized( 1527 | io.osirrc.ciff.CommonIndexFileFormat.Posting.class, io.osirrc.ciff.CommonIndexFileFormat.Posting.Builder.class); 1528 | } 1529 | 1530 | // Construct using io.osirrc.ciff.CommonIndexFileFormat.Posting.newBuilder() 1531 | private Builder() { 1532 | maybeForceBuilderInitialization(); 1533 | } 1534 | 1535 | private Builder( 1536 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 1537 | super(parent); 1538 | maybeForceBuilderInitialization(); 1539 | } 1540 | private void maybeForceBuilderInitialization() { 1541 | if (com.google.protobuf.GeneratedMessageV3 1542 | .alwaysUseFieldBuilders) { 1543 | } 1544 | } 1545 | @java.lang.Override 1546 | public Builder clear() { 1547 | super.clear(); 1548 | docid_ = 0; 1549 | 1550 | tf_ = 0; 1551 | 1552 | return this; 1553 | } 1554 | 1555 | @java.lang.Override 1556 | public com.google.protobuf.Descriptors.Descriptor 1557 | getDescriptorForType() { 1558 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_Posting_descriptor; 1559 | } 1560 | 1561 | @java.lang.Override 1562 | public io.osirrc.ciff.CommonIndexFileFormat.Posting getDefaultInstanceForType() { 1563 | return io.osirrc.ciff.CommonIndexFileFormat.Posting.getDefaultInstance(); 1564 | } 1565 | 1566 | @java.lang.Override 1567 | public io.osirrc.ciff.CommonIndexFileFormat.Posting build() { 1568 | io.osirrc.ciff.CommonIndexFileFormat.Posting result = buildPartial(); 1569 | if (!result.isInitialized()) { 1570 | throw newUninitializedMessageException(result); 1571 | } 1572 | return result; 1573 | } 1574 | 1575 | @java.lang.Override 1576 | public io.osirrc.ciff.CommonIndexFileFormat.Posting buildPartial() { 1577 | io.osirrc.ciff.CommonIndexFileFormat.Posting result = new io.osirrc.ciff.CommonIndexFileFormat.Posting(this); 1578 | result.docid_ = docid_; 1579 | result.tf_ = tf_; 1580 | onBuilt(); 1581 | return result; 1582 | } 1583 | 1584 | @java.lang.Override 1585 | public Builder clone() { 1586 | return super.clone(); 1587 | } 1588 | @java.lang.Override 1589 | public Builder setField( 1590 | com.google.protobuf.Descriptors.FieldDescriptor field, 1591 | java.lang.Object value) { 1592 | return super.setField(field, value); 1593 | } 1594 | @java.lang.Override 1595 | public Builder clearField( 1596 | com.google.protobuf.Descriptors.FieldDescriptor field) { 1597 | return super.clearField(field); 1598 | } 1599 | @java.lang.Override 1600 | public Builder clearOneof( 1601 | com.google.protobuf.Descriptors.OneofDescriptor oneof) { 1602 | return super.clearOneof(oneof); 1603 | } 1604 | @java.lang.Override 1605 | public Builder setRepeatedField( 1606 | com.google.protobuf.Descriptors.FieldDescriptor field, 1607 | int index, java.lang.Object value) { 1608 | return super.setRepeatedField(field, index, value); 1609 | } 1610 | @java.lang.Override 1611 | public Builder addRepeatedField( 1612 | com.google.protobuf.Descriptors.FieldDescriptor field, 1613 | java.lang.Object value) { 1614 | return super.addRepeatedField(field, value); 1615 | } 1616 | @java.lang.Override 1617 | public Builder mergeFrom(com.google.protobuf.Message other) { 1618 | if (other instanceof io.osirrc.ciff.CommonIndexFileFormat.Posting) { 1619 | return mergeFrom((io.osirrc.ciff.CommonIndexFileFormat.Posting)other); 1620 | } else { 1621 | super.mergeFrom(other); 1622 | return this; 1623 | } 1624 | } 1625 | 1626 | public Builder mergeFrom(io.osirrc.ciff.CommonIndexFileFormat.Posting other) { 1627 | if (other == io.osirrc.ciff.CommonIndexFileFormat.Posting.getDefaultInstance()) return this; 1628 | if (other.getDocid() != 0) { 1629 | setDocid(other.getDocid()); 1630 | } 1631 | if (other.getTf() != 0) { 1632 | setTf(other.getTf()); 1633 | } 1634 | this.mergeUnknownFields(other.unknownFields); 1635 | onChanged(); 1636 | return this; 1637 | } 1638 | 1639 | @java.lang.Override 1640 | public final boolean isInitialized() { 1641 | return true; 1642 | } 1643 | 1644 | @java.lang.Override 1645 | public Builder mergeFrom( 1646 | com.google.protobuf.CodedInputStream input, 1647 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1648 | throws java.io.IOException { 1649 | io.osirrc.ciff.CommonIndexFileFormat.Posting parsedMessage = null; 1650 | try { 1651 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); 1652 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1653 | parsedMessage = (io.osirrc.ciff.CommonIndexFileFormat.Posting) e.getUnfinishedMessage(); 1654 | throw e.unwrapIOException(); 1655 | } finally { 1656 | if (parsedMessage != null) { 1657 | mergeFrom(parsedMessage); 1658 | } 1659 | } 1660 | return this; 1661 | } 1662 | 1663 | private int docid_ ; 1664 | /** 1665 | * int32 docid = 1; 1666 | */ 1667 | public int getDocid() { 1668 | return docid_; 1669 | } 1670 | /** 1671 | * int32 docid = 1; 1672 | */ 1673 | public Builder setDocid(int value) { 1674 | 1675 | docid_ = value; 1676 | onChanged(); 1677 | return this; 1678 | } 1679 | /** 1680 | * int32 docid = 1; 1681 | */ 1682 | public Builder clearDocid() { 1683 | 1684 | docid_ = 0; 1685 | onChanged(); 1686 | return this; 1687 | } 1688 | 1689 | private int tf_ ; 1690 | /** 1691 | * int32 tf = 2; 1692 | */ 1693 | public int getTf() { 1694 | return tf_; 1695 | } 1696 | /** 1697 | * int32 tf = 2; 1698 | */ 1699 | public Builder setTf(int value) { 1700 | 1701 | tf_ = value; 1702 | onChanged(); 1703 | return this; 1704 | } 1705 | /** 1706 | * int32 tf = 2; 1707 | */ 1708 | public Builder clearTf() { 1709 | 1710 | tf_ = 0; 1711 | onChanged(); 1712 | return this; 1713 | } 1714 | @java.lang.Override 1715 | public final Builder setUnknownFields( 1716 | final com.google.protobuf.UnknownFieldSet unknownFields) { 1717 | return super.setUnknownFields(unknownFields); 1718 | } 1719 | 1720 | @java.lang.Override 1721 | public final Builder mergeUnknownFields( 1722 | final com.google.protobuf.UnknownFieldSet unknownFields) { 1723 | return super.mergeUnknownFields(unknownFields); 1724 | } 1725 | 1726 | 1727 | // @@protoc_insertion_point(builder_scope:io.osirrc.ciff.Posting) 1728 | } 1729 | 1730 | // @@protoc_insertion_point(class_scope:io.osirrc.ciff.Posting) 1731 | private static final io.osirrc.ciff.CommonIndexFileFormat.Posting DEFAULT_INSTANCE; 1732 | static { 1733 | DEFAULT_INSTANCE = new io.osirrc.ciff.CommonIndexFileFormat.Posting(); 1734 | } 1735 | 1736 | public static io.osirrc.ciff.CommonIndexFileFormat.Posting getDefaultInstance() { 1737 | return DEFAULT_INSTANCE; 1738 | } 1739 | 1740 | private static final com.google.protobuf.Parser 1741 | PARSER = new com.google.protobuf.AbstractParser() { 1742 | @java.lang.Override 1743 | public Posting parsePartialFrom( 1744 | com.google.protobuf.CodedInputStream input, 1745 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1746 | throws com.google.protobuf.InvalidProtocolBufferException { 1747 | return new Posting(input, extensionRegistry); 1748 | } 1749 | }; 1750 | 1751 | public static com.google.protobuf.Parser parser() { 1752 | return PARSER; 1753 | } 1754 | 1755 | @java.lang.Override 1756 | public com.google.protobuf.Parser getParserForType() { 1757 | return PARSER; 1758 | } 1759 | 1760 | @java.lang.Override 1761 | public io.osirrc.ciff.CommonIndexFileFormat.Posting getDefaultInstanceForType() { 1762 | return DEFAULT_INSTANCE; 1763 | } 1764 | 1765 | } 1766 | 1767 | public interface PostingsListOrBuilder extends 1768 | // @@protoc_insertion_point(interface_extends:io.osirrc.ciff.PostingsList) 1769 | com.google.protobuf.MessageOrBuilder { 1770 | 1771 | /** 1772 | *
1773 |      * The term.
1774 |      * 
1775 | * 1776 | * string term = 1; 1777 | */ 1778 | java.lang.String getTerm(); 1779 | /** 1780 | *
1781 |      * The term.
1782 |      * 
1783 | * 1784 | * string term = 1; 1785 | */ 1786 | com.google.protobuf.ByteString 1787 | getTermBytes(); 1788 | 1789 | /** 1790 | *
1791 |      * The document frequency.
1792 |      * 
1793 | * 1794 | * int64 df = 2; 1795 | */ 1796 | long getDf(); 1797 | 1798 | /** 1799 | *
1800 |      * The collection frequency.
1801 |      * 
1802 | * 1803 | * int64 cf = 3; 1804 | */ 1805 | long getCf(); 1806 | 1807 | /** 1808 | * repeated .io.osirrc.ciff.Posting postings = 4; 1809 | */ 1810 | java.util.List 1811 | getPostingsList(); 1812 | /** 1813 | * repeated .io.osirrc.ciff.Posting postings = 4; 1814 | */ 1815 | io.osirrc.ciff.CommonIndexFileFormat.Posting getPostings(int index); 1816 | /** 1817 | * repeated .io.osirrc.ciff.Posting postings = 4; 1818 | */ 1819 | int getPostingsCount(); 1820 | /** 1821 | * repeated .io.osirrc.ciff.Posting postings = 4; 1822 | */ 1823 | java.util.List 1824 | getPostingsOrBuilderList(); 1825 | /** 1826 | * repeated .io.osirrc.ciff.Posting postings = 4; 1827 | */ 1828 | io.osirrc.ciff.CommonIndexFileFormat.PostingOrBuilder getPostingsOrBuilder( 1829 | int index); 1830 | } 1831 | /** 1832 | *
1833 |    * A postings list, comprised of one ore more postings.
1834 |    * 
1835 | * 1836 | * Protobuf type {@code io.osirrc.ciff.PostingsList} 1837 | */ 1838 | public static final class PostingsList extends 1839 | com.google.protobuf.GeneratedMessageV3 implements 1840 | // @@protoc_insertion_point(message_implements:io.osirrc.ciff.PostingsList) 1841 | PostingsListOrBuilder { 1842 | private static final long serialVersionUID = 0L; 1843 | // Use PostingsList.newBuilder() to construct. 1844 | private PostingsList(com.google.protobuf.GeneratedMessageV3.Builder builder) { 1845 | super(builder); 1846 | } 1847 | private PostingsList() { 1848 | term_ = ""; 1849 | postings_ = java.util.Collections.emptyList(); 1850 | } 1851 | 1852 | @java.lang.Override 1853 | @SuppressWarnings({"unused"}) 1854 | protected java.lang.Object newInstance( 1855 | UnusedPrivateParameter unused) { 1856 | return new PostingsList(); 1857 | } 1858 | 1859 | @java.lang.Override 1860 | public final com.google.protobuf.UnknownFieldSet 1861 | getUnknownFields() { 1862 | return this.unknownFields; 1863 | } 1864 | private PostingsList( 1865 | com.google.protobuf.CodedInputStream input, 1866 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1867 | throws com.google.protobuf.InvalidProtocolBufferException { 1868 | this(); 1869 | if (extensionRegistry == null) { 1870 | throw new java.lang.NullPointerException(); 1871 | } 1872 | int mutable_bitField0_ = 0; 1873 | com.google.protobuf.UnknownFieldSet.Builder unknownFields = 1874 | com.google.protobuf.UnknownFieldSet.newBuilder(); 1875 | try { 1876 | boolean done = false; 1877 | while (!done) { 1878 | int tag = input.readTag(); 1879 | switch (tag) { 1880 | case 0: 1881 | done = true; 1882 | break; 1883 | case 10: { 1884 | java.lang.String s = input.readStringRequireUtf8(); 1885 | 1886 | term_ = s; 1887 | break; 1888 | } 1889 | case 16: { 1890 | 1891 | df_ = input.readInt64(); 1892 | break; 1893 | } 1894 | case 24: { 1895 | 1896 | cf_ = input.readInt64(); 1897 | break; 1898 | } 1899 | case 34: { 1900 | if (!((mutable_bitField0_ & 0x00000001) != 0)) { 1901 | postings_ = new java.util.ArrayList(); 1902 | mutable_bitField0_ |= 0x00000001; 1903 | } 1904 | postings_.add( 1905 | input.readMessage(io.osirrc.ciff.CommonIndexFileFormat.Posting.parser(), extensionRegistry)); 1906 | break; 1907 | } 1908 | default: { 1909 | if (!parseUnknownField( 1910 | input, unknownFields, extensionRegistry, tag)) { 1911 | done = true; 1912 | } 1913 | break; 1914 | } 1915 | } 1916 | } 1917 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1918 | throw e.setUnfinishedMessage(this); 1919 | } catch (java.io.IOException e) { 1920 | throw new com.google.protobuf.InvalidProtocolBufferException( 1921 | e).setUnfinishedMessage(this); 1922 | } finally { 1923 | if (((mutable_bitField0_ & 0x00000001) != 0)) { 1924 | postings_ = java.util.Collections.unmodifiableList(postings_); 1925 | } 1926 | this.unknownFields = unknownFields.build(); 1927 | makeExtensionsImmutable(); 1928 | } 1929 | } 1930 | public static final com.google.protobuf.Descriptors.Descriptor 1931 | getDescriptor() { 1932 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_PostingsList_descriptor; 1933 | } 1934 | 1935 | @java.lang.Override 1936 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 1937 | internalGetFieldAccessorTable() { 1938 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_PostingsList_fieldAccessorTable 1939 | .ensureFieldAccessorsInitialized( 1940 | io.osirrc.ciff.CommonIndexFileFormat.PostingsList.class, io.osirrc.ciff.CommonIndexFileFormat.PostingsList.Builder.class); 1941 | } 1942 | 1943 | public static final int TERM_FIELD_NUMBER = 1; 1944 | private volatile java.lang.Object term_; 1945 | /** 1946 | *
1947 |      * The term.
1948 |      * 
1949 | * 1950 | * string term = 1; 1951 | */ 1952 | public java.lang.String getTerm() { 1953 | java.lang.Object ref = term_; 1954 | if (ref instanceof java.lang.String) { 1955 | return (java.lang.String) ref; 1956 | } else { 1957 | com.google.protobuf.ByteString bs = 1958 | (com.google.protobuf.ByteString) ref; 1959 | java.lang.String s = bs.toStringUtf8(); 1960 | term_ = s; 1961 | return s; 1962 | } 1963 | } 1964 | /** 1965 | *
1966 |      * The term.
1967 |      * 
1968 | * 1969 | * string term = 1; 1970 | */ 1971 | public com.google.protobuf.ByteString 1972 | getTermBytes() { 1973 | java.lang.Object ref = term_; 1974 | if (ref instanceof java.lang.String) { 1975 | com.google.protobuf.ByteString b = 1976 | com.google.protobuf.ByteString.copyFromUtf8( 1977 | (java.lang.String) ref); 1978 | term_ = b; 1979 | return b; 1980 | } else { 1981 | return (com.google.protobuf.ByteString) ref; 1982 | } 1983 | } 1984 | 1985 | public static final int DF_FIELD_NUMBER = 2; 1986 | private long df_; 1987 | /** 1988 | *
1989 |      * The document frequency.
1990 |      * 
1991 | * 1992 | * int64 df = 2; 1993 | */ 1994 | public long getDf() { 1995 | return df_; 1996 | } 1997 | 1998 | public static final int CF_FIELD_NUMBER = 3; 1999 | private long cf_; 2000 | /** 2001 | *
2002 |      * The collection frequency.
2003 |      * 
2004 | * 2005 | * int64 cf = 3; 2006 | */ 2007 | public long getCf() { 2008 | return cf_; 2009 | } 2010 | 2011 | public static final int POSTINGS_FIELD_NUMBER = 4; 2012 | private java.util.List postings_; 2013 | /** 2014 | * repeated .io.osirrc.ciff.Posting postings = 4; 2015 | */ 2016 | public java.util.List getPostingsList() { 2017 | return postings_; 2018 | } 2019 | /** 2020 | * repeated .io.osirrc.ciff.Posting postings = 4; 2021 | */ 2022 | public java.util.List 2023 | getPostingsOrBuilderList() { 2024 | return postings_; 2025 | } 2026 | /** 2027 | * repeated .io.osirrc.ciff.Posting postings = 4; 2028 | */ 2029 | public int getPostingsCount() { 2030 | return postings_.size(); 2031 | } 2032 | /** 2033 | * repeated .io.osirrc.ciff.Posting postings = 4; 2034 | */ 2035 | public io.osirrc.ciff.CommonIndexFileFormat.Posting getPostings(int index) { 2036 | return postings_.get(index); 2037 | } 2038 | /** 2039 | * repeated .io.osirrc.ciff.Posting postings = 4; 2040 | */ 2041 | public io.osirrc.ciff.CommonIndexFileFormat.PostingOrBuilder getPostingsOrBuilder( 2042 | int index) { 2043 | return postings_.get(index); 2044 | } 2045 | 2046 | private byte memoizedIsInitialized = -1; 2047 | @java.lang.Override 2048 | public final boolean isInitialized() { 2049 | byte isInitialized = memoizedIsInitialized; 2050 | if (isInitialized == 1) return true; 2051 | if (isInitialized == 0) return false; 2052 | 2053 | memoizedIsInitialized = 1; 2054 | return true; 2055 | } 2056 | 2057 | @java.lang.Override 2058 | public void writeTo(com.google.protobuf.CodedOutputStream output) 2059 | throws java.io.IOException { 2060 | if (!getTermBytes().isEmpty()) { 2061 | com.google.protobuf.GeneratedMessageV3.writeString(output, 1, term_); 2062 | } 2063 | if (df_ != 0L) { 2064 | output.writeInt64(2, df_); 2065 | } 2066 | if (cf_ != 0L) { 2067 | output.writeInt64(3, cf_); 2068 | } 2069 | for (int i = 0; i < postings_.size(); i++) { 2070 | output.writeMessage(4, postings_.get(i)); 2071 | } 2072 | unknownFields.writeTo(output); 2073 | } 2074 | 2075 | @java.lang.Override 2076 | public int getSerializedSize() { 2077 | int size = memoizedSize; 2078 | if (size != -1) return size; 2079 | 2080 | size = 0; 2081 | if (!getTermBytes().isEmpty()) { 2082 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, term_); 2083 | } 2084 | if (df_ != 0L) { 2085 | size += com.google.protobuf.CodedOutputStream 2086 | .computeInt64Size(2, df_); 2087 | } 2088 | if (cf_ != 0L) { 2089 | size += com.google.protobuf.CodedOutputStream 2090 | .computeInt64Size(3, cf_); 2091 | } 2092 | for (int i = 0; i < postings_.size(); i++) { 2093 | size += com.google.protobuf.CodedOutputStream 2094 | .computeMessageSize(4, postings_.get(i)); 2095 | } 2096 | size += unknownFields.getSerializedSize(); 2097 | memoizedSize = size; 2098 | return size; 2099 | } 2100 | 2101 | @java.lang.Override 2102 | public boolean equals(final java.lang.Object obj) { 2103 | if (obj == this) { 2104 | return true; 2105 | } 2106 | if (!(obj instanceof io.osirrc.ciff.CommonIndexFileFormat.PostingsList)) { 2107 | return super.equals(obj); 2108 | } 2109 | io.osirrc.ciff.CommonIndexFileFormat.PostingsList other = (io.osirrc.ciff.CommonIndexFileFormat.PostingsList) obj; 2110 | 2111 | if (!getTerm() 2112 | .equals(other.getTerm())) return false; 2113 | if (getDf() 2114 | != other.getDf()) return false; 2115 | if (getCf() 2116 | != other.getCf()) return false; 2117 | if (!getPostingsList() 2118 | .equals(other.getPostingsList())) return false; 2119 | if (!unknownFields.equals(other.unknownFields)) return false; 2120 | return true; 2121 | } 2122 | 2123 | @java.lang.Override 2124 | public int hashCode() { 2125 | if (memoizedHashCode != 0) { 2126 | return memoizedHashCode; 2127 | } 2128 | int hash = 41; 2129 | hash = (19 * hash) + getDescriptor().hashCode(); 2130 | hash = (37 * hash) + TERM_FIELD_NUMBER; 2131 | hash = (53 * hash) + getTerm().hashCode(); 2132 | hash = (37 * hash) + DF_FIELD_NUMBER; 2133 | hash = (53 * hash) + com.google.protobuf.Internal.hashLong( 2134 | getDf()); 2135 | hash = (37 * hash) + CF_FIELD_NUMBER; 2136 | hash = (53 * hash) + com.google.protobuf.Internal.hashLong( 2137 | getCf()); 2138 | if (getPostingsCount() > 0) { 2139 | hash = (37 * hash) + POSTINGS_FIELD_NUMBER; 2140 | hash = (53 * hash) + getPostingsList().hashCode(); 2141 | } 2142 | hash = (29 * hash) + unknownFields.hashCode(); 2143 | memoizedHashCode = hash; 2144 | return hash; 2145 | } 2146 | 2147 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList parseFrom( 2148 | java.nio.ByteBuffer data) 2149 | throws com.google.protobuf.InvalidProtocolBufferException { 2150 | return PARSER.parseFrom(data); 2151 | } 2152 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList parseFrom( 2153 | java.nio.ByteBuffer data, 2154 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2155 | throws com.google.protobuf.InvalidProtocolBufferException { 2156 | return PARSER.parseFrom(data, extensionRegistry); 2157 | } 2158 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList parseFrom( 2159 | com.google.protobuf.ByteString data) 2160 | throws com.google.protobuf.InvalidProtocolBufferException { 2161 | return PARSER.parseFrom(data); 2162 | } 2163 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList parseFrom( 2164 | com.google.protobuf.ByteString data, 2165 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2166 | throws com.google.protobuf.InvalidProtocolBufferException { 2167 | return PARSER.parseFrom(data, extensionRegistry); 2168 | } 2169 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList parseFrom(byte[] data) 2170 | throws com.google.protobuf.InvalidProtocolBufferException { 2171 | return PARSER.parseFrom(data); 2172 | } 2173 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList parseFrom( 2174 | byte[] data, 2175 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2176 | throws com.google.protobuf.InvalidProtocolBufferException { 2177 | return PARSER.parseFrom(data, extensionRegistry); 2178 | } 2179 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList parseFrom(java.io.InputStream input) 2180 | throws java.io.IOException { 2181 | return com.google.protobuf.GeneratedMessageV3 2182 | .parseWithIOException(PARSER, input); 2183 | } 2184 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList parseFrom( 2185 | java.io.InputStream input, 2186 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2187 | throws java.io.IOException { 2188 | return com.google.protobuf.GeneratedMessageV3 2189 | .parseWithIOException(PARSER, input, extensionRegistry); 2190 | } 2191 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList parseDelimitedFrom(java.io.InputStream input) 2192 | throws java.io.IOException { 2193 | return com.google.protobuf.GeneratedMessageV3 2194 | .parseDelimitedWithIOException(PARSER, input); 2195 | } 2196 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList parseDelimitedFrom( 2197 | java.io.InputStream input, 2198 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2199 | throws java.io.IOException { 2200 | return com.google.protobuf.GeneratedMessageV3 2201 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry); 2202 | } 2203 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList parseFrom( 2204 | com.google.protobuf.CodedInputStream input) 2205 | throws java.io.IOException { 2206 | return com.google.protobuf.GeneratedMessageV3 2207 | .parseWithIOException(PARSER, input); 2208 | } 2209 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList parseFrom( 2210 | com.google.protobuf.CodedInputStream input, 2211 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2212 | throws java.io.IOException { 2213 | return com.google.protobuf.GeneratedMessageV3 2214 | .parseWithIOException(PARSER, input, extensionRegistry); 2215 | } 2216 | 2217 | @java.lang.Override 2218 | public Builder newBuilderForType() { return newBuilder(); } 2219 | public static Builder newBuilder() { 2220 | return DEFAULT_INSTANCE.toBuilder(); 2221 | } 2222 | public static Builder newBuilder(io.osirrc.ciff.CommonIndexFileFormat.PostingsList prototype) { 2223 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 2224 | } 2225 | @java.lang.Override 2226 | public Builder toBuilder() { 2227 | return this == DEFAULT_INSTANCE 2228 | ? new Builder() : new Builder().mergeFrom(this); 2229 | } 2230 | 2231 | @java.lang.Override 2232 | protected Builder newBuilderForType( 2233 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 2234 | Builder builder = new Builder(parent); 2235 | return builder; 2236 | } 2237 | /** 2238 | *
2239 |      * A postings list, comprised of one ore more postings.
2240 |      * 
2241 | * 2242 | * Protobuf type {@code io.osirrc.ciff.PostingsList} 2243 | */ 2244 | public static final class Builder extends 2245 | com.google.protobuf.GeneratedMessageV3.Builder implements 2246 | // @@protoc_insertion_point(builder_implements:io.osirrc.ciff.PostingsList) 2247 | io.osirrc.ciff.CommonIndexFileFormat.PostingsListOrBuilder { 2248 | public static final com.google.protobuf.Descriptors.Descriptor 2249 | getDescriptor() { 2250 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_PostingsList_descriptor; 2251 | } 2252 | 2253 | @java.lang.Override 2254 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 2255 | internalGetFieldAccessorTable() { 2256 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_PostingsList_fieldAccessorTable 2257 | .ensureFieldAccessorsInitialized( 2258 | io.osirrc.ciff.CommonIndexFileFormat.PostingsList.class, io.osirrc.ciff.CommonIndexFileFormat.PostingsList.Builder.class); 2259 | } 2260 | 2261 | // Construct using io.osirrc.ciff.CommonIndexFileFormat.PostingsList.newBuilder() 2262 | private Builder() { 2263 | maybeForceBuilderInitialization(); 2264 | } 2265 | 2266 | private Builder( 2267 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 2268 | super(parent); 2269 | maybeForceBuilderInitialization(); 2270 | } 2271 | private void maybeForceBuilderInitialization() { 2272 | if (com.google.protobuf.GeneratedMessageV3 2273 | .alwaysUseFieldBuilders) { 2274 | getPostingsFieldBuilder(); 2275 | } 2276 | } 2277 | @java.lang.Override 2278 | public Builder clear() { 2279 | super.clear(); 2280 | term_ = ""; 2281 | 2282 | df_ = 0L; 2283 | 2284 | cf_ = 0L; 2285 | 2286 | if (postingsBuilder_ == null) { 2287 | postings_ = java.util.Collections.emptyList(); 2288 | bitField0_ = (bitField0_ & ~0x00000001); 2289 | } else { 2290 | postingsBuilder_.clear(); 2291 | } 2292 | return this; 2293 | } 2294 | 2295 | @java.lang.Override 2296 | public com.google.protobuf.Descriptors.Descriptor 2297 | getDescriptorForType() { 2298 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_PostingsList_descriptor; 2299 | } 2300 | 2301 | @java.lang.Override 2302 | public io.osirrc.ciff.CommonIndexFileFormat.PostingsList getDefaultInstanceForType() { 2303 | return io.osirrc.ciff.CommonIndexFileFormat.PostingsList.getDefaultInstance(); 2304 | } 2305 | 2306 | @java.lang.Override 2307 | public io.osirrc.ciff.CommonIndexFileFormat.PostingsList build() { 2308 | io.osirrc.ciff.CommonIndexFileFormat.PostingsList result = buildPartial(); 2309 | if (!result.isInitialized()) { 2310 | throw newUninitializedMessageException(result); 2311 | } 2312 | return result; 2313 | } 2314 | 2315 | @java.lang.Override 2316 | public io.osirrc.ciff.CommonIndexFileFormat.PostingsList buildPartial() { 2317 | io.osirrc.ciff.CommonIndexFileFormat.PostingsList result = new io.osirrc.ciff.CommonIndexFileFormat.PostingsList(this); 2318 | int from_bitField0_ = bitField0_; 2319 | result.term_ = term_; 2320 | result.df_ = df_; 2321 | result.cf_ = cf_; 2322 | if (postingsBuilder_ == null) { 2323 | if (((bitField0_ & 0x00000001) != 0)) { 2324 | postings_ = java.util.Collections.unmodifiableList(postings_); 2325 | bitField0_ = (bitField0_ & ~0x00000001); 2326 | } 2327 | result.postings_ = postings_; 2328 | } else { 2329 | result.postings_ = postingsBuilder_.build(); 2330 | } 2331 | onBuilt(); 2332 | return result; 2333 | } 2334 | 2335 | @java.lang.Override 2336 | public Builder clone() { 2337 | return super.clone(); 2338 | } 2339 | @java.lang.Override 2340 | public Builder setField( 2341 | com.google.protobuf.Descriptors.FieldDescriptor field, 2342 | java.lang.Object value) { 2343 | return super.setField(field, value); 2344 | } 2345 | @java.lang.Override 2346 | public Builder clearField( 2347 | com.google.protobuf.Descriptors.FieldDescriptor field) { 2348 | return super.clearField(field); 2349 | } 2350 | @java.lang.Override 2351 | public Builder clearOneof( 2352 | com.google.protobuf.Descriptors.OneofDescriptor oneof) { 2353 | return super.clearOneof(oneof); 2354 | } 2355 | @java.lang.Override 2356 | public Builder setRepeatedField( 2357 | com.google.protobuf.Descriptors.FieldDescriptor field, 2358 | int index, java.lang.Object value) { 2359 | return super.setRepeatedField(field, index, value); 2360 | } 2361 | @java.lang.Override 2362 | public Builder addRepeatedField( 2363 | com.google.protobuf.Descriptors.FieldDescriptor field, 2364 | java.lang.Object value) { 2365 | return super.addRepeatedField(field, value); 2366 | } 2367 | @java.lang.Override 2368 | public Builder mergeFrom(com.google.protobuf.Message other) { 2369 | if (other instanceof io.osirrc.ciff.CommonIndexFileFormat.PostingsList) { 2370 | return mergeFrom((io.osirrc.ciff.CommonIndexFileFormat.PostingsList)other); 2371 | } else { 2372 | super.mergeFrom(other); 2373 | return this; 2374 | } 2375 | } 2376 | 2377 | public Builder mergeFrom(io.osirrc.ciff.CommonIndexFileFormat.PostingsList other) { 2378 | if (other == io.osirrc.ciff.CommonIndexFileFormat.PostingsList.getDefaultInstance()) return this; 2379 | if (!other.getTerm().isEmpty()) { 2380 | term_ = other.term_; 2381 | onChanged(); 2382 | } 2383 | if (other.getDf() != 0L) { 2384 | setDf(other.getDf()); 2385 | } 2386 | if (other.getCf() != 0L) { 2387 | setCf(other.getCf()); 2388 | } 2389 | if (postingsBuilder_ == null) { 2390 | if (!other.postings_.isEmpty()) { 2391 | if (postings_.isEmpty()) { 2392 | postings_ = other.postings_; 2393 | bitField0_ = (bitField0_ & ~0x00000001); 2394 | } else { 2395 | ensurePostingsIsMutable(); 2396 | postings_.addAll(other.postings_); 2397 | } 2398 | onChanged(); 2399 | } 2400 | } else { 2401 | if (!other.postings_.isEmpty()) { 2402 | if (postingsBuilder_.isEmpty()) { 2403 | postingsBuilder_.dispose(); 2404 | postingsBuilder_ = null; 2405 | postings_ = other.postings_; 2406 | bitField0_ = (bitField0_ & ~0x00000001); 2407 | postingsBuilder_ = 2408 | com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? 2409 | getPostingsFieldBuilder() : null; 2410 | } else { 2411 | postingsBuilder_.addAllMessages(other.postings_); 2412 | } 2413 | } 2414 | } 2415 | this.mergeUnknownFields(other.unknownFields); 2416 | onChanged(); 2417 | return this; 2418 | } 2419 | 2420 | @java.lang.Override 2421 | public final boolean isInitialized() { 2422 | return true; 2423 | } 2424 | 2425 | @java.lang.Override 2426 | public Builder mergeFrom( 2427 | com.google.protobuf.CodedInputStream input, 2428 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2429 | throws java.io.IOException { 2430 | io.osirrc.ciff.CommonIndexFileFormat.PostingsList parsedMessage = null; 2431 | try { 2432 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); 2433 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 2434 | parsedMessage = (io.osirrc.ciff.CommonIndexFileFormat.PostingsList) e.getUnfinishedMessage(); 2435 | throw e.unwrapIOException(); 2436 | } finally { 2437 | if (parsedMessage != null) { 2438 | mergeFrom(parsedMessage); 2439 | } 2440 | } 2441 | return this; 2442 | } 2443 | private int bitField0_; 2444 | 2445 | private java.lang.Object term_ = ""; 2446 | /** 2447 | *
2448 |        * The term.
2449 |        * 
2450 | * 2451 | * string term = 1; 2452 | */ 2453 | public java.lang.String getTerm() { 2454 | java.lang.Object ref = term_; 2455 | if (!(ref instanceof java.lang.String)) { 2456 | com.google.protobuf.ByteString bs = 2457 | (com.google.protobuf.ByteString) ref; 2458 | java.lang.String s = bs.toStringUtf8(); 2459 | term_ = s; 2460 | return s; 2461 | } else { 2462 | return (java.lang.String) ref; 2463 | } 2464 | } 2465 | /** 2466 | *
2467 |        * The term.
2468 |        * 
2469 | * 2470 | * string term = 1; 2471 | */ 2472 | public com.google.protobuf.ByteString 2473 | getTermBytes() { 2474 | java.lang.Object ref = term_; 2475 | if (ref instanceof String) { 2476 | com.google.protobuf.ByteString b = 2477 | com.google.protobuf.ByteString.copyFromUtf8( 2478 | (java.lang.String) ref); 2479 | term_ = b; 2480 | return b; 2481 | } else { 2482 | return (com.google.protobuf.ByteString) ref; 2483 | } 2484 | } 2485 | /** 2486 | *
2487 |        * The term.
2488 |        * 
2489 | * 2490 | * string term = 1; 2491 | */ 2492 | public Builder setTerm( 2493 | java.lang.String value) { 2494 | if (value == null) { 2495 | throw new NullPointerException(); 2496 | } 2497 | 2498 | term_ = value; 2499 | onChanged(); 2500 | return this; 2501 | } 2502 | /** 2503 | *
2504 |        * The term.
2505 |        * 
2506 | * 2507 | * string term = 1; 2508 | */ 2509 | public Builder clearTerm() { 2510 | 2511 | term_ = getDefaultInstance().getTerm(); 2512 | onChanged(); 2513 | return this; 2514 | } 2515 | /** 2516 | *
2517 |        * The term.
2518 |        * 
2519 | * 2520 | * string term = 1; 2521 | */ 2522 | public Builder setTermBytes( 2523 | com.google.protobuf.ByteString value) { 2524 | if (value == null) { 2525 | throw new NullPointerException(); 2526 | } 2527 | checkByteStringIsUtf8(value); 2528 | 2529 | term_ = value; 2530 | onChanged(); 2531 | return this; 2532 | } 2533 | 2534 | private long df_ ; 2535 | /** 2536 | *
2537 |        * The document frequency.
2538 |        * 
2539 | * 2540 | * int64 df = 2; 2541 | */ 2542 | public long getDf() { 2543 | return df_; 2544 | } 2545 | /** 2546 | *
2547 |        * The document frequency.
2548 |        * 
2549 | * 2550 | * int64 df = 2; 2551 | */ 2552 | public Builder setDf(long value) { 2553 | 2554 | df_ = value; 2555 | onChanged(); 2556 | return this; 2557 | } 2558 | /** 2559 | *
2560 |        * The document frequency.
2561 |        * 
2562 | * 2563 | * int64 df = 2; 2564 | */ 2565 | public Builder clearDf() { 2566 | 2567 | df_ = 0L; 2568 | onChanged(); 2569 | return this; 2570 | } 2571 | 2572 | private long cf_ ; 2573 | /** 2574 | *
2575 |        * The collection frequency.
2576 |        * 
2577 | * 2578 | * int64 cf = 3; 2579 | */ 2580 | public long getCf() { 2581 | return cf_; 2582 | } 2583 | /** 2584 | *
2585 |        * The collection frequency.
2586 |        * 
2587 | * 2588 | * int64 cf = 3; 2589 | */ 2590 | public Builder setCf(long value) { 2591 | 2592 | cf_ = value; 2593 | onChanged(); 2594 | return this; 2595 | } 2596 | /** 2597 | *
2598 |        * The collection frequency.
2599 |        * 
2600 | * 2601 | * int64 cf = 3; 2602 | */ 2603 | public Builder clearCf() { 2604 | 2605 | cf_ = 0L; 2606 | onChanged(); 2607 | return this; 2608 | } 2609 | 2610 | private java.util.List postings_ = 2611 | java.util.Collections.emptyList(); 2612 | private void ensurePostingsIsMutable() { 2613 | if (!((bitField0_ & 0x00000001) != 0)) { 2614 | postings_ = new java.util.ArrayList(postings_); 2615 | bitField0_ |= 0x00000001; 2616 | } 2617 | } 2618 | 2619 | private com.google.protobuf.RepeatedFieldBuilderV3< 2620 | io.osirrc.ciff.CommonIndexFileFormat.Posting, io.osirrc.ciff.CommonIndexFileFormat.Posting.Builder, io.osirrc.ciff.CommonIndexFileFormat.PostingOrBuilder> postingsBuilder_; 2621 | 2622 | /** 2623 | * repeated .io.osirrc.ciff.Posting postings = 4; 2624 | */ 2625 | public java.util.List getPostingsList() { 2626 | if (postingsBuilder_ == null) { 2627 | return java.util.Collections.unmodifiableList(postings_); 2628 | } else { 2629 | return postingsBuilder_.getMessageList(); 2630 | } 2631 | } 2632 | /** 2633 | * repeated .io.osirrc.ciff.Posting postings = 4; 2634 | */ 2635 | public int getPostingsCount() { 2636 | if (postingsBuilder_ == null) { 2637 | return postings_.size(); 2638 | } else { 2639 | return postingsBuilder_.getCount(); 2640 | } 2641 | } 2642 | /** 2643 | * repeated .io.osirrc.ciff.Posting postings = 4; 2644 | */ 2645 | public io.osirrc.ciff.CommonIndexFileFormat.Posting getPostings(int index) { 2646 | if (postingsBuilder_ == null) { 2647 | return postings_.get(index); 2648 | } else { 2649 | return postingsBuilder_.getMessage(index); 2650 | } 2651 | } 2652 | /** 2653 | * repeated .io.osirrc.ciff.Posting postings = 4; 2654 | */ 2655 | public Builder setPostings( 2656 | int index, io.osirrc.ciff.CommonIndexFileFormat.Posting value) { 2657 | if (postingsBuilder_ == null) { 2658 | if (value == null) { 2659 | throw new NullPointerException(); 2660 | } 2661 | ensurePostingsIsMutable(); 2662 | postings_.set(index, value); 2663 | onChanged(); 2664 | } else { 2665 | postingsBuilder_.setMessage(index, value); 2666 | } 2667 | return this; 2668 | } 2669 | /** 2670 | * repeated .io.osirrc.ciff.Posting postings = 4; 2671 | */ 2672 | public Builder setPostings( 2673 | int index, io.osirrc.ciff.CommonIndexFileFormat.Posting.Builder builderForValue) { 2674 | if (postingsBuilder_ == null) { 2675 | ensurePostingsIsMutable(); 2676 | postings_.set(index, builderForValue.build()); 2677 | onChanged(); 2678 | } else { 2679 | postingsBuilder_.setMessage(index, builderForValue.build()); 2680 | } 2681 | return this; 2682 | } 2683 | /** 2684 | * repeated .io.osirrc.ciff.Posting postings = 4; 2685 | */ 2686 | public Builder addPostings(io.osirrc.ciff.CommonIndexFileFormat.Posting value) { 2687 | if (postingsBuilder_ == null) { 2688 | if (value == null) { 2689 | throw new NullPointerException(); 2690 | } 2691 | ensurePostingsIsMutable(); 2692 | postings_.add(value); 2693 | onChanged(); 2694 | } else { 2695 | postingsBuilder_.addMessage(value); 2696 | } 2697 | return this; 2698 | } 2699 | /** 2700 | * repeated .io.osirrc.ciff.Posting postings = 4; 2701 | */ 2702 | public Builder addPostings( 2703 | int index, io.osirrc.ciff.CommonIndexFileFormat.Posting value) { 2704 | if (postingsBuilder_ == null) { 2705 | if (value == null) { 2706 | throw new NullPointerException(); 2707 | } 2708 | ensurePostingsIsMutable(); 2709 | postings_.add(index, value); 2710 | onChanged(); 2711 | } else { 2712 | postingsBuilder_.addMessage(index, value); 2713 | } 2714 | return this; 2715 | } 2716 | /** 2717 | * repeated .io.osirrc.ciff.Posting postings = 4; 2718 | */ 2719 | public Builder addPostings( 2720 | io.osirrc.ciff.CommonIndexFileFormat.Posting.Builder builderForValue) { 2721 | if (postingsBuilder_ == null) { 2722 | ensurePostingsIsMutable(); 2723 | postings_.add(builderForValue.build()); 2724 | onChanged(); 2725 | } else { 2726 | postingsBuilder_.addMessage(builderForValue.build()); 2727 | } 2728 | return this; 2729 | } 2730 | /** 2731 | * repeated .io.osirrc.ciff.Posting postings = 4; 2732 | */ 2733 | public Builder addPostings( 2734 | int index, io.osirrc.ciff.CommonIndexFileFormat.Posting.Builder builderForValue) { 2735 | if (postingsBuilder_ == null) { 2736 | ensurePostingsIsMutable(); 2737 | postings_.add(index, builderForValue.build()); 2738 | onChanged(); 2739 | } else { 2740 | postingsBuilder_.addMessage(index, builderForValue.build()); 2741 | } 2742 | return this; 2743 | } 2744 | /** 2745 | * repeated .io.osirrc.ciff.Posting postings = 4; 2746 | */ 2747 | public Builder addAllPostings( 2748 | java.lang.Iterable values) { 2749 | if (postingsBuilder_ == null) { 2750 | ensurePostingsIsMutable(); 2751 | com.google.protobuf.AbstractMessageLite.Builder.addAll( 2752 | values, postings_); 2753 | onChanged(); 2754 | } else { 2755 | postingsBuilder_.addAllMessages(values); 2756 | } 2757 | return this; 2758 | } 2759 | /** 2760 | * repeated .io.osirrc.ciff.Posting postings = 4; 2761 | */ 2762 | public Builder clearPostings() { 2763 | if (postingsBuilder_ == null) { 2764 | postings_ = java.util.Collections.emptyList(); 2765 | bitField0_ = (bitField0_ & ~0x00000001); 2766 | onChanged(); 2767 | } else { 2768 | postingsBuilder_.clear(); 2769 | } 2770 | return this; 2771 | } 2772 | /** 2773 | * repeated .io.osirrc.ciff.Posting postings = 4; 2774 | */ 2775 | public Builder removePostings(int index) { 2776 | if (postingsBuilder_ == null) { 2777 | ensurePostingsIsMutable(); 2778 | postings_.remove(index); 2779 | onChanged(); 2780 | } else { 2781 | postingsBuilder_.remove(index); 2782 | } 2783 | return this; 2784 | } 2785 | /** 2786 | * repeated .io.osirrc.ciff.Posting postings = 4; 2787 | */ 2788 | public io.osirrc.ciff.CommonIndexFileFormat.Posting.Builder getPostingsBuilder( 2789 | int index) { 2790 | return getPostingsFieldBuilder().getBuilder(index); 2791 | } 2792 | /** 2793 | * repeated .io.osirrc.ciff.Posting postings = 4; 2794 | */ 2795 | public io.osirrc.ciff.CommonIndexFileFormat.PostingOrBuilder getPostingsOrBuilder( 2796 | int index) { 2797 | if (postingsBuilder_ == null) { 2798 | return postings_.get(index); } else { 2799 | return postingsBuilder_.getMessageOrBuilder(index); 2800 | } 2801 | } 2802 | /** 2803 | * repeated .io.osirrc.ciff.Posting postings = 4; 2804 | */ 2805 | public java.util.List 2806 | getPostingsOrBuilderList() { 2807 | if (postingsBuilder_ != null) { 2808 | return postingsBuilder_.getMessageOrBuilderList(); 2809 | } else { 2810 | return java.util.Collections.unmodifiableList(postings_); 2811 | } 2812 | } 2813 | /** 2814 | * repeated .io.osirrc.ciff.Posting postings = 4; 2815 | */ 2816 | public io.osirrc.ciff.CommonIndexFileFormat.Posting.Builder addPostingsBuilder() { 2817 | return getPostingsFieldBuilder().addBuilder( 2818 | io.osirrc.ciff.CommonIndexFileFormat.Posting.getDefaultInstance()); 2819 | } 2820 | /** 2821 | * repeated .io.osirrc.ciff.Posting postings = 4; 2822 | */ 2823 | public io.osirrc.ciff.CommonIndexFileFormat.Posting.Builder addPostingsBuilder( 2824 | int index) { 2825 | return getPostingsFieldBuilder().addBuilder( 2826 | index, io.osirrc.ciff.CommonIndexFileFormat.Posting.getDefaultInstance()); 2827 | } 2828 | /** 2829 | * repeated .io.osirrc.ciff.Posting postings = 4; 2830 | */ 2831 | public java.util.List 2832 | getPostingsBuilderList() { 2833 | return getPostingsFieldBuilder().getBuilderList(); 2834 | } 2835 | private com.google.protobuf.RepeatedFieldBuilderV3< 2836 | io.osirrc.ciff.CommonIndexFileFormat.Posting, io.osirrc.ciff.CommonIndexFileFormat.Posting.Builder, io.osirrc.ciff.CommonIndexFileFormat.PostingOrBuilder> 2837 | getPostingsFieldBuilder() { 2838 | if (postingsBuilder_ == null) { 2839 | postingsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< 2840 | io.osirrc.ciff.CommonIndexFileFormat.Posting, io.osirrc.ciff.CommonIndexFileFormat.Posting.Builder, io.osirrc.ciff.CommonIndexFileFormat.PostingOrBuilder>( 2841 | postings_, 2842 | ((bitField0_ & 0x00000001) != 0), 2843 | getParentForChildren(), 2844 | isClean()); 2845 | postings_ = null; 2846 | } 2847 | return postingsBuilder_; 2848 | } 2849 | @java.lang.Override 2850 | public final Builder setUnknownFields( 2851 | final com.google.protobuf.UnknownFieldSet unknownFields) { 2852 | return super.setUnknownFields(unknownFields); 2853 | } 2854 | 2855 | @java.lang.Override 2856 | public final Builder mergeUnknownFields( 2857 | final com.google.protobuf.UnknownFieldSet unknownFields) { 2858 | return super.mergeUnknownFields(unknownFields); 2859 | } 2860 | 2861 | 2862 | // @@protoc_insertion_point(builder_scope:io.osirrc.ciff.PostingsList) 2863 | } 2864 | 2865 | // @@protoc_insertion_point(class_scope:io.osirrc.ciff.PostingsList) 2866 | private static final io.osirrc.ciff.CommonIndexFileFormat.PostingsList DEFAULT_INSTANCE; 2867 | static { 2868 | DEFAULT_INSTANCE = new io.osirrc.ciff.CommonIndexFileFormat.PostingsList(); 2869 | } 2870 | 2871 | public static io.osirrc.ciff.CommonIndexFileFormat.PostingsList getDefaultInstance() { 2872 | return DEFAULT_INSTANCE; 2873 | } 2874 | 2875 | private static final com.google.protobuf.Parser 2876 | PARSER = new com.google.protobuf.AbstractParser() { 2877 | @java.lang.Override 2878 | public PostingsList parsePartialFrom( 2879 | com.google.protobuf.CodedInputStream input, 2880 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2881 | throws com.google.protobuf.InvalidProtocolBufferException { 2882 | return new PostingsList(input, extensionRegistry); 2883 | } 2884 | }; 2885 | 2886 | public static com.google.protobuf.Parser parser() { 2887 | return PARSER; 2888 | } 2889 | 2890 | @java.lang.Override 2891 | public com.google.protobuf.Parser getParserForType() { 2892 | return PARSER; 2893 | } 2894 | 2895 | @java.lang.Override 2896 | public io.osirrc.ciff.CommonIndexFileFormat.PostingsList getDefaultInstanceForType() { 2897 | return DEFAULT_INSTANCE; 2898 | } 2899 | 2900 | } 2901 | 2902 | public interface DocRecordOrBuilder extends 2903 | // @@protoc_insertion_point(interface_extends:io.osirrc.ciff.DocRecord) 2904 | com.google.protobuf.MessageOrBuilder { 2905 | 2906 | /** 2907 | *
2908 |      * Refers to the docid in the postings lists.
2909 |      * 
2910 | * 2911 | * int32 docid = 1; 2912 | */ 2913 | int getDocid(); 2914 | 2915 | /** 2916 | *
2917 |      * Refers to a docid in the external collection.
2918 |      * 
2919 | * 2920 | * string collection_docid = 2; 2921 | */ 2922 | java.lang.String getCollectionDocid(); 2923 | /** 2924 | *
2925 |      * Refers to a docid in the external collection.
2926 |      * 
2927 | * 2928 | * string collection_docid = 2; 2929 | */ 2930 | com.google.protobuf.ByteString 2931 | getCollectionDocidBytes(); 2932 | 2933 | /** 2934 | *
2935 |      * Length of this document.
2936 |      * 
2937 | * 2938 | * int32 doclength = 3; 2939 | */ 2940 | int getDoclength(); 2941 | } 2942 | /** 2943 | *
2944 |    * A record containing metadata about an individual document.
2945 |    * 
2946 | * 2947 | * Protobuf type {@code io.osirrc.ciff.DocRecord} 2948 | */ 2949 | public static final class DocRecord extends 2950 | com.google.protobuf.GeneratedMessageV3 implements 2951 | // @@protoc_insertion_point(message_implements:io.osirrc.ciff.DocRecord) 2952 | DocRecordOrBuilder { 2953 | private static final long serialVersionUID = 0L; 2954 | // Use DocRecord.newBuilder() to construct. 2955 | private DocRecord(com.google.protobuf.GeneratedMessageV3.Builder builder) { 2956 | super(builder); 2957 | } 2958 | private DocRecord() { 2959 | collectionDocid_ = ""; 2960 | } 2961 | 2962 | @java.lang.Override 2963 | @SuppressWarnings({"unused"}) 2964 | protected java.lang.Object newInstance( 2965 | UnusedPrivateParameter unused) { 2966 | return new DocRecord(); 2967 | } 2968 | 2969 | @java.lang.Override 2970 | public final com.google.protobuf.UnknownFieldSet 2971 | getUnknownFields() { 2972 | return this.unknownFields; 2973 | } 2974 | private DocRecord( 2975 | com.google.protobuf.CodedInputStream input, 2976 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2977 | throws com.google.protobuf.InvalidProtocolBufferException { 2978 | this(); 2979 | if (extensionRegistry == null) { 2980 | throw new java.lang.NullPointerException(); 2981 | } 2982 | com.google.protobuf.UnknownFieldSet.Builder unknownFields = 2983 | com.google.protobuf.UnknownFieldSet.newBuilder(); 2984 | try { 2985 | boolean done = false; 2986 | while (!done) { 2987 | int tag = input.readTag(); 2988 | switch (tag) { 2989 | case 0: 2990 | done = true; 2991 | break; 2992 | case 8: { 2993 | 2994 | docid_ = input.readInt32(); 2995 | break; 2996 | } 2997 | case 18: { 2998 | java.lang.String s = input.readStringRequireUtf8(); 2999 | 3000 | collectionDocid_ = s; 3001 | break; 3002 | } 3003 | case 24: { 3004 | 3005 | doclength_ = input.readInt32(); 3006 | break; 3007 | } 3008 | default: { 3009 | if (!parseUnknownField( 3010 | input, unknownFields, extensionRegistry, tag)) { 3011 | done = true; 3012 | } 3013 | break; 3014 | } 3015 | } 3016 | } 3017 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 3018 | throw e.setUnfinishedMessage(this); 3019 | } catch (java.io.IOException e) { 3020 | throw new com.google.protobuf.InvalidProtocolBufferException( 3021 | e).setUnfinishedMessage(this); 3022 | } finally { 3023 | this.unknownFields = unknownFields.build(); 3024 | makeExtensionsImmutable(); 3025 | } 3026 | } 3027 | public static final com.google.protobuf.Descriptors.Descriptor 3028 | getDescriptor() { 3029 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_DocRecord_descriptor; 3030 | } 3031 | 3032 | @java.lang.Override 3033 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 3034 | internalGetFieldAccessorTable() { 3035 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_DocRecord_fieldAccessorTable 3036 | .ensureFieldAccessorsInitialized( 3037 | io.osirrc.ciff.CommonIndexFileFormat.DocRecord.class, io.osirrc.ciff.CommonIndexFileFormat.DocRecord.Builder.class); 3038 | } 3039 | 3040 | public static final int DOCID_FIELD_NUMBER = 1; 3041 | private int docid_; 3042 | /** 3043 | *
3044 |      * Refers to the docid in the postings lists.
3045 |      * 
3046 | * 3047 | * int32 docid = 1; 3048 | */ 3049 | public int getDocid() { 3050 | return docid_; 3051 | } 3052 | 3053 | public static final int COLLECTION_DOCID_FIELD_NUMBER = 2; 3054 | private volatile java.lang.Object collectionDocid_; 3055 | /** 3056 | *
3057 |      * Refers to a docid in the external collection.
3058 |      * 
3059 | * 3060 | * string collection_docid = 2; 3061 | */ 3062 | public java.lang.String getCollectionDocid() { 3063 | java.lang.Object ref = collectionDocid_; 3064 | if (ref instanceof java.lang.String) { 3065 | return (java.lang.String) ref; 3066 | } else { 3067 | com.google.protobuf.ByteString bs = 3068 | (com.google.protobuf.ByteString) ref; 3069 | java.lang.String s = bs.toStringUtf8(); 3070 | collectionDocid_ = s; 3071 | return s; 3072 | } 3073 | } 3074 | /** 3075 | *
3076 |      * Refers to a docid in the external collection.
3077 |      * 
3078 | * 3079 | * string collection_docid = 2; 3080 | */ 3081 | public com.google.protobuf.ByteString 3082 | getCollectionDocidBytes() { 3083 | java.lang.Object ref = collectionDocid_; 3084 | if (ref instanceof java.lang.String) { 3085 | com.google.protobuf.ByteString b = 3086 | com.google.protobuf.ByteString.copyFromUtf8( 3087 | (java.lang.String) ref); 3088 | collectionDocid_ = b; 3089 | return b; 3090 | } else { 3091 | return (com.google.protobuf.ByteString) ref; 3092 | } 3093 | } 3094 | 3095 | public static final int DOCLENGTH_FIELD_NUMBER = 3; 3096 | private int doclength_; 3097 | /** 3098 | *
3099 |      * Length of this document.
3100 |      * 
3101 | * 3102 | * int32 doclength = 3; 3103 | */ 3104 | public int getDoclength() { 3105 | return doclength_; 3106 | } 3107 | 3108 | private byte memoizedIsInitialized = -1; 3109 | @java.lang.Override 3110 | public final boolean isInitialized() { 3111 | byte isInitialized = memoizedIsInitialized; 3112 | if (isInitialized == 1) return true; 3113 | if (isInitialized == 0) return false; 3114 | 3115 | memoizedIsInitialized = 1; 3116 | return true; 3117 | } 3118 | 3119 | @java.lang.Override 3120 | public void writeTo(com.google.protobuf.CodedOutputStream output) 3121 | throws java.io.IOException { 3122 | if (docid_ != 0) { 3123 | output.writeInt32(1, docid_); 3124 | } 3125 | if (!getCollectionDocidBytes().isEmpty()) { 3126 | com.google.protobuf.GeneratedMessageV3.writeString(output, 2, collectionDocid_); 3127 | } 3128 | if (doclength_ != 0) { 3129 | output.writeInt32(3, doclength_); 3130 | } 3131 | unknownFields.writeTo(output); 3132 | } 3133 | 3134 | @java.lang.Override 3135 | public int getSerializedSize() { 3136 | int size = memoizedSize; 3137 | if (size != -1) return size; 3138 | 3139 | size = 0; 3140 | if (docid_ != 0) { 3141 | size += com.google.protobuf.CodedOutputStream 3142 | .computeInt32Size(1, docid_); 3143 | } 3144 | if (!getCollectionDocidBytes().isEmpty()) { 3145 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, collectionDocid_); 3146 | } 3147 | if (doclength_ != 0) { 3148 | size += com.google.protobuf.CodedOutputStream 3149 | .computeInt32Size(3, doclength_); 3150 | } 3151 | size += unknownFields.getSerializedSize(); 3152 | memoizedSize = size; 3153 | return size; 3154 | } 3155 | 3156 | @java.lang.Override 3157 | public boolean equals(final java.lang.Object obj) { 3158 | if (obj == this) { 3159 | return true; 3160 | } 3161 | if (!(obj instanceof io.osirrc.ciff.CommonIndexFileFormat.DocRecord)) { 3162 | return super.equals(obj); 3163 | } 3164 | io.osirrc.ciff.CommonIndexFileFormat.DocRecord other = (io.osirrc.ciff.CommonIndexFileFormat.DocRecord) obj; 3165 | 3166 | if (getDocid() 3167 | != other.getDocid()) return false; 3168 | if (!getCollectionDocid() 3169 | .equals(other.getCollectionDocid())) return false; 3170 | if (getDoclength() 3171 | != other.getDoclength()) return false; 3172 | if (!unknownFields.equals(other.unknownFields)) return false; 3173 | return true; 3174 | } 3175 | 3176 | @java.lang.Override 3177 | public int hashCode() { 3178 | if (memoizedHashCode != 0) { 3179 | return memoizedHashCode; 3180 | } 3181 | int hash = 41; 3182 | hash = (19 * hash) + getDescriptor().hashCode(); 3183 | hash = (37 * hash) + DOCID_FIELD_NUMBER; 3184 | hash = (53 * hash) + getDocid(); 3185 | hash = (37 * hash) + COLLECTION_DOCID_FIELD_NUMBER; 3186 | hash = (53 * hash) + getCollectionDocid().hashCode(); 3187 | hash = (37 * hash) + DOCLENGTH_FIELD_NUMBER; 3188 | hash = (53 * hash) + getDoclength(); 3189 | hash = (29 * hash) + unknownFields.hashCode(); 3190 | memoizedHashCode = hash; 3191 | return hash; 3192 | } 3193 | 3194 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord parseFrom( 3195 | java.nio.ByteBuffer data) 3196 | throws com.google.protobuf.InvalidProtocolBufferException { 3197 | return PARSER.parseFrom(data); 3198 | } 3199 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord parseFrom( 3200 | java.nio.ByteBuffer data, 3201 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 3202 | throws com.google.protobuf.InvalidProtocolBufferException { 3203 | return PARSER.parseFrom(data, extensionRegistry); 3204 | } 3205 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord parseFrom( 3206 | com.google.protobuf.ByteString data) 3207 | throws com.google.protobuf.InvalidProtocolBufferException { 3208 | return PARSER.parseFrom(data); 3209 | } 3210 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord parseFrom( 3211 | com.google.protobuf.ByteString data, 3212 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 3213 | throws com.google.protobuf.InvalidProtocolBufferException { 3214 | return PARSER.parseFrom(data, extensionRegistry); 3215 | } 3216 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord parseFrom(byte[] data) 3217 | throws com.google.protobuf.InvalidProtocolBufferException { 3218 | return PARSER.parseFrom(data); 3219 | } 3220 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord parseFrom( 3221 | byte[] data, 3222 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 3223 | throws com.google.protobuf.InvalidProtocolBufferException { 3224 | return PARSER.parseFrom(data, extensionRegistry); 3225 | } 3226 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord parseFrom(java.io.InputStream input) 3227 | throws java.io.IOException { 3228 | return com.google.protobuf.GeneratedMessageV3 3229 | .parseWithIOException(PARSER, input); 3230 | } 3231 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord parseFrom( 3232 | java.io.InputStream input, 3233 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 3234 | throws java.io.IOException { 3235 | return com.google.protobuf.GeneratedMessageV3 3236 | .parseWithIOException(PARSER, input, extensionRegistry); 3237 | } 3238 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord parseDelimitedFrom(java.io.InputStream input) 3239 | throws java.io.IOException { 3240 | return com.google.protobuf.GeneratedMessageV3 3241 | .parseDelimitedWithIOException(PARSER, input); 3242 | } 3243 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord parseDelimitedFrom( 3244 | java.io.InputStream input, 3245 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 3246 | throws java.io.IOException { 3247 | return com.google.protobuf.GeneratedMessageV3 3248 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry); 3249 | } 3250 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord parseFrom( 3251 | com.google.protobuf.CodedInputStream input) 3252 | throws java.io.IOException { 3253 | return com.google.protobuf.GeneratedMessageV3 3254 | .parseWithIOException(PARSER, input); 3255 | } 3256 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord parseFrom( 3257 | com.google.protobuf.CodedInputStream input, 3258 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 3259 | throws java.io.IOException { 3260 | return com.google.protobuf.GeneratedMessageV3 3261 | .parseWithIOException(PARSER, input, extensionRegistry); 3262 | } 3263 | 3264 | @java.lang.Override 3265 | public Builder newBuilderForType() { return newBuilder(); } 3266 | public static Builder newBuilder() { 3267 | return DEFAULT_INSTANCE.toBuilder(); 3268 | } 3269 | public static Builder newBuilder(io.osirrc.ciff.CommonIndexFileFormat.DocRecord prototype) { 3270 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 3271 | } 3272 | @java.lang.Override 3273 | public Builder toBuilder() { 3274 | return this == DEFAULT_INSTANCE 3275 | ? new Builder() : new Builder().mergeFrom(this); 3276 | } 3277 | 3278 | @java.lang.Override 3279 | protected Builder newBuilderForType( 3280 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 3281 | Builder builder = new Builder(parent); 3282 | return builder; 3283 | } 3284 | /** 3285 | *
3286 |      * A record containing metadata about an individual document.
3287 |      * 
3288 | * 3289 | * Protobuf type {@code io.osirrc.ciff.DocRecord} 3290 | */ 3291 | public static final class Builder extends 3292 | com.google.protobuf.GeneratedMessageV3.Builder implements 3293 | // @@protoc_insertion_point(builder_implements:io.osirrc.ciff.DocRecord) 3294 | io.osirrc.ciff.CommonIndexFileFormat.DocRecordOrBuilder { 3295 | public static final com.google.protobuf.Descriptors.Descriptor 3296 | getDescriptor() { 3297 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_DocRecord_descriptor; 3298 | } 3299 | 3300 | @java.lang.Override 3301 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 3302 | internalGetFieldAccessorTable() { 3303 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_DocRecord_fieldAccessorTable 3304 | .ensureFieldAccessorsInitialized( 3305 | io.osirrc.ciff.CommonIndexFileFormat.DocRecord.class, io.osirrc.ciff.CommonIndexFileFormat.DocRecord.Builder.class); 3306 | } 3307 | 3308 | // Construct using io.osirrc.ciff.CommonIndexFileFormat.DocRecord.newBuilder() 3309 | private Builder() { 3310 | maybeForceBuilderInitialization(); 3311 | } 3312 | 3313 | private Builder( 3314 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 3315 | super(parent); 3316 | maybeForceBuilderInitialization(); 3317 | } 3318 | private void maybeForceBuilderInitialization() { 3319 | if (com.google.protobuf.GeneratedMessageV3 3320 | .alwaysUseFieldBuilders) { 3321 | } 3322 | } 3323 | @java.lang.Override 3324 | public Builder clear() { 3325 | super.clear(); 3326 | docid_ = 0; 3327 | 3328 | collectionDocid_ = ""; 3329 | 3330 | doclength_ = 0; 3331 | 3332 | return this; 3333 | } 3334 | 3335 | @java.lang.Override 3336 | public com.google.protobuf.Descriptors.Descriptor 3337 | getDescriptorForType() { 3338 | return io.osirrc.ciff.CommonIndexFileFormat.internal_static_io_osirrc_ciff_DocRecord_descriptor; 3339 | } 3340 | 3341 | @java.lang.Override 3342 | public io.osirrc.ciff.CommonIndexFileFormat.DocRecord getDefaultInstanceForType() { 3343 | return io.osirrc.ciff.CommonIndexFileFormat.DocRecord.getDefaultInstance(); 3344 | } 3345 | 3346 | @java.lang.Override 3347 | public io.osirrc.ciff.CommonIndexFileFormat.DocRecord build() { 3348 | io.osirrc.ciff.CommonIndexFileFormat.DocRecord result = buildPartial(); 3349 | if (!result.isInitialized()) { 3350 | throw newUninitializedMessageException(result); 3351 | } 3352 | return result; 3353 | } 3354 | 3355 | @java.lang.Override 3356 | public io.osirrc.ciff.CommonIndexFileFormat.DocRecord buildPartial() { 3357 | io.osirrc.ciff.CommonIndexFileFormat.DocRecord result = new io.osirrc.ciff.CommonIndexFileFormat.DocRecord(this); 3358 | result.docid_ = docid_; 3359 | result.collectionDocid_ = collectionDocid_; 3360 | result.doclength_ = doclength_; 3361 | onBuilt(); 3362 | return result; 3363 | } 3364 | 3365 | @java.lang.Override 3366 | public Builder clone() { 3367 | return super.clone(); 3368 | } 3369 | @java.lang.Override 3370 | public Builder setField( 3371 | com.google.protobuf.Descriptors.FieldDescriptor field, 3372 | java.lang.Object value) { 3373 | return super.setField(field, value); 3374 | } 3375 | @java.lang.Override 3376 | public Builder clearField( 3377 | com.google.protobuf.Descriptors.FieldDescriptor field) { 3378 | return super.clearField(field); 3379 | } 3380 | @java.lang.Override 3381 | public Builder clearOneof( 3382 | com.google.protobuf.Descriptors.OneofDescriptor oneof) { 3383 | return super.clearOneof(oneof); 3384 | } 3385 | @java.lang.Override 3386 | public Builder setRepeatedField( 3387 | com.google.protobuf.Descriptors.FieldDescriptor field, 3388 | int index, java.lang.Object value) { 3389 | return super.setRepeatedField(field, index, value); 3390 | } 3391 | @java.lang.Override 3392 | public Builder addRepeatedField( 3393 | com.google.protobuf.Descriptors.FieldDescriptor field, 3394 | java.lang.Object value) { 3395 | return super.addRepeatedField(field, value); 3396 | } 3397 | @java.lang.Override 3398 | public Builder mergeFrom(com.google.protobuf.Message other) { 3399 | if (other instanceof io.osirrc.ciff.CommonIndexFileFormat.DocRecord) { 3400 | return mergeFrom((io.osirrc.ciff.CommonIndexFileFormat.DocRecord)other); 3401 | } else { 3402 | super.mergeFrom(other); 3403 | return this; 3404 | } 3405 | } 3406 | 3407 | public Builder mergeFrom(io.osirrc.ciff.CommonIndexFileFormat.DocRecord other) { 3408 | if (other == io.osirrc.ciff.CommonIndexFileFormat.DocRecord.getDefaultInstance()) return this; 3409 | if (other.getDocid() != 0) { 3410 | setDocid(other.getDocid()); 3411 | } 3412 | if (!other.getCollectionDocid().isEmpty()) { 3413 | collectionDocid_ = other.collectionDocid_; 3414 | onChanged(); 3415 | } 3416 | if (other.getDoclength() != 0) { 3417 | setDoclength(other.getDoclength()); 3418 | } 3419 | this.mergeUnknownFields(other.unknownFields); 3420 | onChanged(); 3421 | return this; 3422 | } 3423 | 3424 | @java.lang.Override 3425 | public final boolean isInitialized() { 3426 | return true; 3427 | } 3428 | 3429 | @java.lang.Override 3430 | public Builder mergeFrom( 3431 | com.google.protobuf.CodedInputStream input, 3432 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 3433 | throws java.io.IOException { 3434 | io.osirrc.ciff.CommonIndexFileFormat.DocRecord parsedMessage = null; 3435 | try { 3436 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); 3437 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 3438 | parsedMessage = (io.osirrc.ciff.CommonIndexFileFormat.DocRecord) e.getUnfinishedMessage(); 3439 | throw e.unwrapIOException(); 3440 | } finally { 3441 | if (parsedMessage != null) { 3442 | mergeFrom(parsedMessage); 3443 | } 3444 | } 3445 | return this; 3446 | } 3447 | 3448 | private int docid_ ; 3449 | /** 3450 | *
3451 |        * Refers to the docid in the postings lists.
3452 |        * 
3453 | * 3454 | * int32 docid = 1; 3455 | */ 3456 | public int getDocid() { 3457 | return docid_; 3458 | } 3459 | /** 3460 | *
3461 |        * Refers to the docid in the postings lists.
3462 |        * 
3463 | * 3464 | * int32 docid = 1; 3465 | */ 3466 | public Builder setDocid(int value) { 3467 | 3468 | docid_ = value; 3469 | onChanged(); 3470 | return this; 3471 | } 3472 | /** 3473 | *
3474 |        * Refers to the docid in the postings lists.
3475 |        * 
3476 | * 3477 | * int32 docid = 1; 3478 | */ 3479 | public Builder clearDocid() { 3480 | 3481 | docid_ = 0; 3482 | onChanged(); 3483 | return this; 3484 | } 3485 | 3486 | private java.lang.Object collectionDocid_ = ""; 3487 | /** 3488 | *
3489 |        * Refers to a docid in the external collection.
3490 |        * 
3491 | * 3492 | * string collection_docid = 2; 3493 | */ 3494 | public java.lang.String getCollectionDocid() { 3495 | java.lang.Object ref = collectionDocid_; 3496 | if (!(ref instanceof java.lang.String)) { 3497 | com.google.protobuf.ByteString bs = 3498 | (com.google.protobuf.ByteString) ref; 3499 | java.lang.String s = bs.toStringUtf8(); 3500 | collectionDocid_ = s; 3501 | return s; 3502 | } else { 3503 | return (java.lang.String) ref; 3504 | } 3505 | } 3506 | /** 3507 | *
3508 |        * Refers to a docid in the external collection.
3509 |        * 
3510 | * 3511 | * string collection_docid = 2; 3512 | */ 3513 | public com.google.protobuf.ByteString 3514 | getCollectionDocidBytes() { 3515 | java.lang.Object ref = collectionDocid_; 3516 | if (ref instanceof String) { 3517 | com.google.protobuf.ByteString b = 3518 | com.google.protobuf.ByteString.copyFromUtf8( 3519 | (java.lang.String) ref); 3520 | collectionDocid_ = b; 3521 | return b; 3522 | } else { 3523 | return (com.google.protobuf.ByteString) ref; 3524 | } 3525 | } 3526 | /** 3527 | *
3528 |        * Refers to a docid in the external collection.
3529 |        * 
3530 | * 3531 | * string collection_docid = 2; 3532 | */ 3533 | public Builder setCollectionDocid( 3534 | java.lang.String value) { 3535 | if (value == null) { 3536 | throw new NullPointerException(); 3537 | } 3538 | 3539 | collectionDocid_ = value; 3540 | onChanged(); 3541 | return this; 3542 | } 3543 | /** 3544 | *
3545 |        * Refers to a docid in the external collection.
3546 |        * 
3547 | * 3548 | * string collection_docid = 2; 3549 | */ 3550 | public Builder clearCollectionDocid() { 3551 | 3552 | collectionDocid_ = getDefaultInstance().getCollectionDocid(); 3553 | onChanged(); 3554 | return this; 3555 | } 3556 | /** 3557 | *
3558 |        * Refers to a docid in the external collection.
3559 |        * 
3560 | * 3561 | * string collection_docid = 2; 3562 | */ 3563 | public Builder setCollectionDocidBytes( 3564 | com.google.protobuf.ByteString value) { 3565 | if (value == null) { 3566 | throw new NullPointerException(); 3567 | } 3568 | checkByteStringIsUtf8(value); 3569 | 3570 | collectionDocid_ = value; 3571 | onChanged(); 3572 | return this; 3573 | } 3574 | 3575 | private int doclength_ ; 3576 | /** 3577 | *
3578 |        * Length of this document.
3579 |        * 
3580 | * 3581 | * int32 doclength = 3; 3582 | */ 3583 | public int getDoclength() { 3584 | return doclength_; 3585 | } 3586 | /** 3587 | *
3588 |        * Length of this document.
3589 |        * 
3590 | * 3591 | * int32 doclength = 3; 3592 | */ 3593 | public Builder setDoclength(int value) { 3594 | 3595 | doclength_ = value; 3596 | onChanged(); 3597 | return this; 3598 | } 3599 | /** 3600 | *
3601 |        * Length of this document.
3602 |        * 
3603 | * 3604 | * int32 doclength = 3; 3605 | */ 3606 | public Builder clearDoclength() { 3607 | 3608 | doclength_ = 0; 3609 | onChanged(); 3610 | return this; 3611 | } 3612 | @java.lang.Override 3613 | public final Builder setUnknownFields( 3614 | final com.google.protobuf.UnknownFieldSet unknownFields) { 3615 | return super.setUnknownFields(unknownFields); 3616 | } 3617 | 3618 | @java.lang.Override 3619 | public final Builder mergeUnknownFields( 3620 | final com.google.protobuf.UnknownFieldSet unknownFields) { 3621 | return super.mergeUnknownFields(unknownFields); 3622 | } 3623 | 3624 | 3625 | // @@protoc_insertion_point(builder_scope:io.osirrc.ciff.DocRecord) 3626 | } 3627 | 3628 | // @@protoc_insertion_point(class_scope:io.osirrc.ciff.DocRecord) 3629 | private static final io.osirrc.ciff.CommonIndexFileFormat.DocRecord DEFAULT_INSTANCE; 3630 | static { 3631 | DEFAULT_INSTANCE = new io.osirrc.ciff.CommonIndexFileFormat.DocRecord(); 3632 | } 3633 | 3634 | public static io.osirrc.ciff.CommonIndexFileFormat.DocRecord getDefaultInstance() { 3635 | return DEFAULT_INSTANCE; 3636 | } 3637 | 3638 | private static final com.google.protobuf.Parser 3639 | PARSER = new com.google.protobuf.AbstractParser() { 3640 | @java.lang.Override 3641 | public DocRecord parsePartialFrom( 3642 | com.google.protobuf.CodedInputStream input, 3643 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 3644 | throws com.google.protobuf.InvalidProtocolBufferException { 3645 | return new DocRecord(input, extensionRegistry); 3646 | } 3647 | }; 3648 | 3649 | public static com.google.protobuf.Parser parser() { 3650 | return PARSER; 3651 | } 3652 | 3653 | @java.lang.Override 3654 | public com.google.protobuf.Parser getParserForType() { 3655 | return PARSER; 3656 | } 3657 | 3658 | @java.lang.Override 3659 | public io.osirrc.ciff.CommonIndexFileFormat.DocRecord getDefaultInstanceForType() { 3660 | return DEFAULT_INSTANCE; 3661 | } 3662 | 3663 | } 3664 | 3665 | private static final com.google.protobuf.Descriptors.Descriptor 3666 | internal_static_io_osirrc_ciff_Header_descriptor; 3667 | private static final 3668 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 3669 | internal_static_io_osirrc_ciff_Header_fieldAccessorTable; 3670 | private static final com.google.protobuf.Descriptors.Descriptor 3671 | internal_static_io_osirrc_ciff_Posting_descriptor; 3672 | private static final 3673 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 3674 | internal_static_io_osirrc_ciff_Posting_fieldAccessorTable; 3675 | private static final com.google.protobuf.Descriptors.Descriptor 3676 | internal_static_io_osirrc_ciff_PostingsList_descriptor; 3677 | private static final 3678 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 3679 | internal_static_io_osirrc_ciff_PostingsList_fieldAccessorTable; 3680 | private static final com.google.protobuf.Descriptors.Descriptor 3681 | internal_static_io_osirrc_ciff_DocRecord_descriptor; 3682 | private static final 3683 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 3684 | internal_static_io_osirrc_ciff_DocRecord_fieldAccessorTable; 3685 | 3686 | public static com.google.protobuf.Descriptors.FileDescriptor 3687 | getDescriptor() { 3688 | return descriptor; 3689 | } 3690 | private static com.google.protobuf.Descriptors.FileDescriptor 3691 | descriptor; 3692 | static { 3693 | java.lang.String[] descriptorData = { 3694 | "\n-src/main/protobuf/CommonIndexFileForma" + 3695 | "t.proto\022\016io.osirrc.ciff\"\314\001\n\006Header\022\017\n\007ve" + 3696 | "rsion\030\001 \001(\005\022\032\n\022num_postings_lists\030\002 \001(\005\022" + 3697 | "\020\n\010num_docs\030\003 \001(\005\022\034\n\024total_postings_list" + 3698 | "s\030\004 \001(\005\022\022\n\ntotal_docs\030\005 \001(\005\022!\n\031total_ter" + 3699 | "ms_in_collection\030\006 \001(\003\022\031\n\021average_doclen" + 3700 | "gth\030\007 \001(\001\022\023\n\013description\030\010 \001(\t\"$\n\007Postin" + 3701 | "g\022\r\n\005docid\030\001 \001(\005\022\n\n\002tf\030\002 \001(\005\"_\n\014Postings" + 3702 | "List\022\014\n\004term\030\001 \001(\t\022\n\n\002df\030\002 \001(\003\022\n\n\002cf\030\003 \001" + 3703 | "(\003\022)\n\010postings\030\004 \003(\0132\027.io.osirrc.ciff.Po" + 3704 | "sting\"G\n\tDocRecord\022\r\n\005docid\030\001 \001(\005\022\030\n\020col" + 3705 | "lection_docid\030\002 \001(\t\022\021\n\tdoclength\030\003 \001(\005b\006" + 3706 | "proto3" 3707 | }; 3708 | descriptor = com.google.protobuf.Descriptors.FileDescriptor 3709 | .internalBuildGeneratedFileFrom(descriptorData, 3710 | new com.google.protobuf.Descriptors.FileDescriptor[] { 3711 | }); 3712 | internal_static_io_osirrc_ciff_Header_descriptor = 3713 | getDescriptor().getMessageTypes().get(0); 3714 | internal_static_io_osirrc_ciff_Header_fieldAccessorTable = new 3715 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( 3716 | internal_static_io_osirrc_ciff_Header_descriptor, 3717 | new java.lang.String[] { "Version", "NumPostingsLists", "NumDocs", "TotalPostingsLists", "TotalDocs", "TotalTermsInCollection", "AverageDoclength", "Description", }); 3718 | internal_static_io_osirrc_ciff_Posting_descriptor = 3719 | getDescriptor().getMessageTypes().get(1); 3720 | internal_static_io_osirrc_ciff_Posting_fieldAccessorTable = new 3721 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( 3722 | internal_static_io_osirrc_ciff_Posting_descriptor, 3723 | new java.lang.String[] { "Docid", "Tf", }); 3724 | internal_static_io_osirrc_ciff_PostingsList_descriptor = 3725 | getDescriptor().getMessageTypes().get(2); 3726 | internal_static_io_osirrc_ciff_PostingsList_fieldAccessorTable = new 3727 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( 3728 | internal_static_io_osirrc_ciff_PostingsList_descriptor, 3729 | new java.lang.String[] { "Term", "Df", "Cf", "Postings", }); 3730 | internal_static_io_osirrc_ciff_DocRecord_descriptor = 3731 | getDescriptor().getMessageTypes().get(3); 3732 | internal_static_io_osirrc_ciff_DocRecord_fieldAccessorTable = new 3733 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( 3734 | internal_static_io_osirrc_ciff_DocRecord_descriptor, 3735 | new java.lang.String[] { "Docid", "CollectionDocid", "Doclength", }); 3736 | } 3737 | 3738 | // @@protoc_insertion_point(outer_class_scope) 3739 | } 3740 | -------------------------------------------------------------------------------- /src/main/java/io/osirrc/ciff/CommonIndexFileFormatConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CIFF (Common Index File Format): 3 | * an open, binary exchange format for index structures to support search engine interoperability 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package io.osirrc.ciff; 19 | 20 | public class CommonIndexFileFormatConstants { 21 | public final static int VERSION = 1; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/osirrc/ciff/ReadCIFF.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CIFF (Common Index File Format): 3 | * an open, binary exchange format for index structures to support search engine interoperability 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package io.osirrc.ciff; 19 | 20 | import org.kohsuke.args4j.CmdLineException; 21 | import org.kohsuke.args4j.CmdLineParser; 22 | import org.kohsuke.args4j.Option; 23 | import org.kohsuke.args4j.OptionHandlerFilter; 24 | import org.kohsuke.args4j.ParserProperties; 25 | 26 | import java.io.FileInputStream; 27 | import java.io.InputStream; 28 | import java.util.zip.GZIPInputStream; 29 | 30 | public class ReadCIFF { 31 | public static class Args { 32 | @Option(name = "-input", metaVar = "[file]", required = true, usage = "postings file") 33 | public String input = ""; 34 | 35 | @Option(name = "-dumpInterval", metaVar = "[num]", 36 | usage = "prints PostingsList and DocRecord messages at this regular inverval for debugging purposes") 37 | public int dumpInterval = 100000; 38 | } 39 | 40 | public static void main(String[] argv) throws Exception { 41 | Args args = new Args(); 42 | CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(90)); 43 | 44 | try { 45 | parser.parseArgument(argv); 46 | } catch (CmdLineException e) { 47 | System.err.println(e.getMessage()); 48 | parser.printUsage(System.err); 49 | System.err.println("Example: ReadCIFF " + parser.printExample(OptionHandlerFilter.REQUIRED)); 50 | return; 51 | } 52 | 53 | InputStream fileIn; 54 | 55 | if (args.input.endsWith(".gz")) { 56 | fileIn = new GZIPInputStream(new FileInputStream(args.input)); 57 | } else { 58 | fileIn = new FileInputStream(args.input); 59 | } 60 | 61 | System.out.println("Reading header..."); 62 | CommonIndexFileFormat.Header header = CommonIndexFileFormat.Header.parseDelimitedFrom(fileIn); 63 | 64 | System.out.println("=== Header === "); 65 | System.out.println(String.format("version: %,d", header.getVersion())); 66 | System.out.println(String.format("num_postings_lists: %,d", header.getNumPostingsLists())); 67 | System.out.println(String.format("num_doc_records: %,d", header.getNumDocs())); 68 | System.out.println(String.format("total_postings_lists: %,d", header.getTotalPostingsLists())); 69 | System.out.println(String.format("total_docs: %,d", header.getTotalDocs())); 70 | System.out.println(String.format("total_terms_in_collection: %,d", header.getTotalTermsInCollection())); 71 | System.out.println(String.format("average_doclength: %f", header.getAverageDoclength())); 72 | System.out.println(String.format("description: %s", header.getDescription())); 73 | System.out.println(); 74 | 75 | System.out.println(String.format("Expecting %,d PostingsList and %,d DocRecords in this export.\n", 76 | header.getNumPostingsLists(), header.getNumDocs())); 77 | 78 | System.out.println(String.format("Reading every PostingsList, dumping out every %,dth:", args.dumpInterval)); 79 | long sumOfAllTfs = 0; 80 | for (int i=0; i 10 ? 10 : pl.getDf()); j++) { 91 | System.out.print(String.format(" (%d, %d)", pl.getPostings(j).getDocid(), pl.getPostings(j).getTf())); 92 | } 93 | System.out.println(pl.getDf() > 10 ? " ..." : ""); 94 | } 95 | 96 | for (int j=0; j terms) throws IOException { 81 | Counts counts = new Counts(); 82 | 83 | LeafReader leafReader = reader.leaves().get(0).reader(); 84 | TermsEnum termsEnum = leafReader.terms(field).iterator(); 85 | BytesRef bytesRef = termsEnum.next(); 86 | while (bytesRef != null) { 87 | // This is the current term in the dictionary. 88 | String token = bytesRef.utf8ToString(); 89 | counts.total++; 90 | 91 | if (terms != null && !terms.contains(token)) { 92 | bytesRef = termsEnum.next(); 93 | continue; 94 | } 95 | 96 | bytesRef = termsEnum.next(); 97 | counts.export++; 98 | } 99 | 100 | return counts; 101 | } 102 | 103 | public static class Counts { 104 | int export = 0; 105 | int total = 0; 106 | } 107 | 108 | public static void main(String[] argv) throws Exception { 109 | Args args = new Args(); 110 | CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(90)); 111 | 112 | try { 113 | parser.parseArgument(argv); 114 | } catch (CmdLineException e) { 115 | System.err.println(e.getMessage()); 116 | parser.printUsage(System.err); 117 | System.err.println("Example: ExportAnseriniLuceneIndex " + parser.printExample(OptionHandlerFilter.REQUIRED)); 118 | return; 119 | } 120 | 121 | // If specified, load the query terms 122 | Set terms = null; 123 | if (args.termsFile != null) { 124 | terms = new HashSet<>(); 125 | BufferedReader reader = new BufferedReader(new FileReader(args.termsFile)); 126 | String line = reader.readLine(); 127 | while (line != null) { 128 | line = line.strip(); 129 | terms.add(line); 130 | line = reader.readLine(); 131 | } 132 | reader.close(); 133 | System.out.println(String.format("Loaded termsFile, only dumping postings for %d specified terms.", terms.size())); 134 | } 135 | 136 | IndexReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(args.index))); 137 | 138 | if (reader.leaves().size() != 1) { 139 | throw new RuntimeException("There should be only one leaf, index the collection using the -optimize flag"); 140 | } 141 | 142 | OutputStream fileOut; 143 | if (args.output.endsWith(".gz")) { 144 | System.out.println("Inferred from filename suffix to write gzip compressed output..."); 145 | fileOut = new GZIPOutputStream(new FileOutputStream(args.output)); 146 | } else { 147 | fileOut = new FileOutputStream(args.output); 148 | } 149 | 150 | // Go through the index once to count the number of postings lists we're going to export and the vocab size. 151 | // We need this value to populate the header. 152 | System.out.println("Taking a pass through the index to count the number of postings in the index..."); 153 | Counts counts = countPostingsLists(reader, args.contentsField, terms); 154 | System.out.println(String.format("Exporting %d postings lists out of %d total", 155 | counts.export, counts.total)); 156 | 157 | // Write the header. 158 | System.out.println("Writing the header..."); 159 | Header.newBuilder() 160 | .setVersion(CommonIndexFileFormatConstants.VERSION) 161 | .setNumPostingsLists(counts.export) 162 | .setNumDocs(reader.maxDoc()) // We're exporting all docs. 163 | .setTotalPostingsLists(counts.total) 164 | .setTotalDocs(reader.maxDoc()) 165 | .setTotalTermsInCollection(reader.getSumTotalTermFreq(args.contentsField)) 166 | .setAverageDoclength((double) reader.getSumTotalTermFreq(args.contentsField) / reader.maxDoc()) 167 | .setDescription(args.description) 168 | .build().writeDelimitedTo(fileOut); 169 | 170 | // Now we can write the postings lists. 171 | int cnt = 0; 172 | LeafReader leafReader = reader.leaves().get(0).reader(); 173 | TermsEnum termsEnum = leafReader.terms(args.contentsField).iterator(); 174 | BytesRef bytesRef = termsEnum.next(); 175 | while (bytesRef != null) { 176 | // This is the current term in the dictionary. 177 | String token = bytesRef.utf8ToString(); 178 | 179 | if (terms != null && !terms.contains(token)) { 180 | bytesRef = termsEnum.next(); 181 | continue; 182 | } 183 | 184 | Term term = new Term(args.contentsField, token); 185 | long df = reader.docFreq(term); 186 | long cf = reader.totalTermFreq(term); 187 | 188 | PostingsListOrBuilder plBuilder = 189 | PostingsList.newBuilder().setTerm(token).setDf(df).setCf(cf); 190 | 191 | int curDocid; 192 | int prevDocid = -1; 193 | int postingsWritten = 0; 194 | PostingsEnum postingsEnum = leafReader.postings(term); 195 | while (postingsEnum.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) { 196 | curDocid = postingsEnum.docID(); 197 | // gap (i.e., delta) encoding. 198 | int code = prevDocid == -1 ? curDocid : curDocid - prevDocid; 199 | 200 | ((PostingsList.Builder) plBuilder).addPostings( 201 | Posting.newBuilder().setDocid(code).setTf(postingsEnum.freq()).build()); 202 | postingsWritten++; 203 | prevDocid = curDocid; 204 | } 205 | 206 | // The number of postings written should be the same as the df. 207 | if (postingsWritten != df) { 208 | throw new RuntimeException(String.format("Unexpected number of postings! expected %d got %d", df, postingsWritten)); 209 | } 210 | 211 | PostingsList pl = ((PostingsList.Builder) plBuilder).build(); 212 | pl.writeDelimitedTo(fileOut); 213 | 214 | bytesRef = termsEnum.next(); 215 | 216 | cnt++; 217 | if (cnt % 100000 == 0) { 218 | System.out.println("Wrote " + cnt + " postings lists..."); 219 | } 220 | } 221 | System.out.println("Total of " + cnt + " postings lists written."); 222 | 223 | // Read the doclengths (norms) into memory 224 | Map normsMap = new HashMap<>(); 225 | System.out.println("Reading norms into memory..."); 226 | for (LeafReaderContext context : reader.leaves()) { 227 | leafReader = context.reader(); 228 | NumericDocValues docValues = leafReader.getNormValues(args.contentsField); 229 | while (docValues.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) { 230 | normsMap.put(docValues.docID() + context.docBase, SmallFloat.byte4ToInt((byte) docValues.longValue())); 231 | } 232 | } 233 | System.out.println("Done!"); 234 | 235 | // Write the doc records: (docid, collection docid, doclength) 236 | System.out.println("Writing doc records..."); 237 | for (int i=0; i