App Engine Python SDK version $VERSION
[gae.git] / java / src / main / com / google / appengine / api / search / Consistency.java
blob3731baeb87cd544177d2e425e5635157feab22a7
1 // Copyright 2010 Google Inc. All Rights Reserved.
2 package com.google.appengine.api.search;
4 /**
5 * Deprecated. Supported consistency modes by indexes. When creating an index
6 * you may request whether the index is {@link #GLOBAL} or {@link #PER_DOCUMENT}
7 * consistent using this enum. An index with {@link #GLOBAL} consistency, when
8 * searched, returns results with all changes prior to the search request,
9 * committed. For {@link #PER_DOCUMENT} consistent indexes, a search result may
10 * contain some out of date documents. However, any two changes to any document
11 * stored in such an index are applied in the correct order. The benefit of
12 * {@link #PER_DOCUMENT} consistent index is that it provides much higher index
13 * document throughput than a globally consistent one.
15 * <p>Typically, you would use {@link #GLOBAL} consistency if organizing
16 * personal user information, to reflect all changes known to the user in
17 * any search results. The {@link #PER_DOCUMENT} consistency should be used
18 * in indexes that amalgamate information from multiple sources, where no
19 * single user is aware of all collected data.
22 * @deprecated As of 1.7.3. PER_DOCUMENT is the only mode now supported, so
23 * Consistency is not required.
25 @Deprecated
26 public enum Consistency {
27 /**
28 * Globally consistent index, which guarantees that search returns
29 * results including changes submitted before the latest search request.
31 * @deprecated As of 1.7.3. GLOBAL mode is no longer supported.
33 @Deprecated
34 GLOBAL(SearchServicePb.IndexSpec.Consistency.GLOBAL),
36 /**
37 * Document level consistent index, with search results that may not include
38 * the latest changes to the index.
40 PER_DOCUMENT(SearchServicePb.IndexSpec.Consistency.PER_DOCUMENT);
42 private final SearchServicePb.IndexSpec.Consistency consistency;
44 private Consistency(SearchServicePb.IndexSpec.Consistency consistency) {
45 this.consistency = consistency;
48 SearchServicePb.IndexSpec.Consistency getConsistency() {
49 return consistency;
52 static Consistency fromProto(SearchServicePb.IndexSpec.Consistency consistency) {
53 return consistency.equals(SearchServicePb.IndexSpec.Consistency.GLOBAL)
54 ? GLOBAL : PER_DOCUMENT;