Merge "Remove LuceneQueryChangesV7Test"
diff --git a/.buckconfig b/.buckconfig
index 211e878..0d6d484 100644
--- a/.buckconfig
+++ b/.buckconfig
@@ -6,7 +6,7 @@
war_deploy = //tools/maven:war_deploy
war_install = //tools/maven:war_install
chrome = //:chrome
- docs = //Documentation:html
+ docs = //Documentation:searchfree
firefox = //:firefox
gerrit = //:gerrit
release = //:release
diff --git a/Documentation/BUCK b/Documentation/BUCK
index 5ea58fd..48a6525 100644
--- a/Documentation/BUCK
+++ b/Documentation/BUCK
@@ -6,30 +6,25 @@
MAIN = ['//gerrit-pgm:pgm', '//gerrit-gwtui:ui_module']
SRCS = glob(['*.txt'], excludes = ['licenses.txt'])
-genrule(
+genasciidoc(
name = 'html',
- cmd = 'cd $TMP;' +
- 'mkdir -p %s/images;' % DOC_DIR +
- 'unzip -q $(location %s) -d %s/;'
- % (':generate_html', DOC_DIR) +
- 'for s in $SRCS;do ln -s $s %s;done;' % DOC_DIR +
- 'mv %s/*.{jpg,png} %s/images;' % (DOC_DIR, DOC_DIR) +
- 'cp $(location %s) LICENSES.txt;' % ':licenses.txt' +
- 'zip -qr $OUT *',
- srcs = glob([
- 'images/*.jpg',
- 'images/*.png',
- ]) + [':doc.css'],
out = 'html.zip',
+ docdir = DOC_DIR,
+ srcs = SRCS + [':licenses.txt'],
+ attributes = documentation_attributes(git_describe()),
+ backend = 'html5',
visibility = ['PUBLIC'],
)
genasciidoc(
- name = 'generate_html',
+ name = 'searchfree',
+ out = 'searchfree.zip',
+ docdir = DOC_DIR,
srcs = SRCS + [':licenses.txt'],
attributes = documentation_attributes(git_describe()),
backend = 'html5',
- out = 'only_html.zip',
+ searchbox = False,
+ visibility = ['PUBLIC'],
)
genrule(
diff --git a/Documentation/asciidoc.defs b/Documentation/asciidoc.defs
index 6581dd7..2520c74 100644
--- a/Documentation/asciidoc.defs
+++ b/Documentation/asciidoc.defs
@@ -12,14 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-def genasciidoc(
+def genasciidoc_htmlonly(
name,
out,
srcs = [],
attributes = [],
backend = None,
+ searchbox = True,
visibility = []):
- EXPN = '.expn'
+ EXPN = '.' + name + '_expn'
asciidoc = [
'$(exe //lib/asciidoctor:asciidoc)',
@@ -51,9 +52,9 @@
genrule(
name = ex,
- cmd = '$(exe :replace_macros) --suffix=' + EXPN +
- ' -s ' + passed_src +
- ' -o $OUT',
+ cmd = '$(exe :replace_macros) --suffix="%s"' % EXPN +
+ ' -s ' + passed_src + ' -o $OUT' +
+ (' --searchbox' if searchbox else ' --no-searchbox'),
srcs = srcs,
out = ex,
)
@@ -69,3 +70,41 @@
out = out,
visibility = visibility,
)
+
+def genasciidoc(
+ name,
+ out,
+ docdir,
+ srcs = [],
+ attributes = [],
+ backend = None,
+ searchbox = True,
+ visibility = []):
+ SUFFIX = '_htmlonly'
+
+ genasciidoc_htmlonly(
+ name = name + SUFFIX,
+ srcs = srcs,
+ attributes = attributes,
+ backend = backend,
+ searchbox = searchbox,
+ out = name + SUFFIX + '.zip',
+ )
+
+ genrule(
+ name = name,
+ cmd = 'cd $TMP;' +
+ 'mkdir -p %s/images;' % docdir +
+ 'unzip -q $(location %s) -d %s/;'
+ % (':' + name + SUFFIX, docdir) +
+ 'for s in $SRCS;do ln -s $s %s;done;' % docdir +
+ 'mv %s/*.{jpg,png} %s/images;' % (docdir, docdir) +
+ 'cp $(location %s) LICENSES.txt;' % ':licenses.txt' +
+ 'zip -qr $OUT *',
+ srcs = glob([
+ 'images/*.jpg',
+ 'images/*.png',
+ ]) + [':doc.css'],
+ out = out,
+ visibility = visibility,
+ )
diff --git a/Documentation/dev-buck.txt b/Documentation/dev-buck.txt
index fee3996..3c87ca5 100644
--- a/Documentation/dev-buck.txt
+++ b/Documentation/dev-buck.txt
@@ -196,22 +196,23 @@
[[documentation]]
=== Documentation
-To build only the documentation:
+To build only the documentation for testing or static hosting:
----
buck build docs
----
-The generated html files will be placed in:
+The generated html files will NOT come with the search box, and will be
+placed in:
----
- buck-out/gen/Documentation/html__tmp/Documentation
+ buck-out/gen/Documentation/searchfree__tmp/Documentation
----
-The html files will also be bundled into `html.zip` in this location:
+The html files will also be bundled into `searchfree.zip` in this location:
----
- buck-out/gen/Documentation/html.zip
+ buck-out/gen/Documentation/searchfree.zip
----
To build the executable WAR with the documentation included:
diff --git a/Documentation/dev-release.txt b/Documentation/dev-release.txt
index 84613c2..b78ee13 100644
--- a/Documentation/dev-release.txt
+++ b/Documentation/dev-release.txt
@@ -336,7 +336,13 @@
gerrit-documentation] storage bucket. The `gerrit-documentation`
storage bucket is accessible via the
link:https://cloud.google.com/console[Google Developers Console].
-** Documentation html files must be extracted from `buck-out/gen/Documentation/html.zip`
+** Documentation html files must be extracted from
+`buck-out/gen/Documentation/searchfree.zip` after generating with:
+
+----
+ buck build docs
+----
+
* Update Google Code project links
** Go to http://code.google.com/p/gerrit/admin
** Update the documentation link in the `Resources` section of the
diff --git a/Documentation/replace_macros.py b/Documentation/replace_macros.py
index 7623382..b159250 100755
--- a/Documentation/replace_macros.py
+++ b/Documentation/replace_macros.py
@@ -84,6 +84,10 @@
opts.add_option('-o', '--out', help='output file')
opts.add_option('-s', '--src', help='source file')
opts.add_option('-x', '--suffix', help='suffix for included filenames')
+opts.add_option('-b', '--searchbox', action="store_true", default=True,
+ help="generate the search boxes")
+opts.add_option('--no-searchbox', action="store_false", dest='searchbox',
+ help="don't generate the search boxes")
options, _ = opts.parse_args()
try:
@@ -99,7 +103,8 @@
last_line = ''
elif PAT_SEARCHBOX.match(last_line):
# Case of 'SEARCHBOX\n---------'
- out_file.write(SEARCH_BOX)
+ if options.searchbox:
+ out_file.write(SEARCH_BOX)
last_line = ''
elif PAT_INCLUDE.match(line):
# Case of 'include::<filename>'
diff --git a/gerrit-lucene/src/main/java/com/google/gerrit/lucene/SubIndex.java b/gerrit-lucene/src/main/java/com/google/gerrit/lucene/SubIndex.java
index 4ee3bf4..688835a 100644
--- a/gerrit-lucene/src/main/java/com/google/gerrit/lucene/SubIndex.java
+++ b/gerrit-lucene/src/main/java/com/google/gerrit/lucene/SubIndex.java
@@ -159,7 +159,7 @@
try {
writer.getIndexWriter().commit();
try {
- writer.getIndexWriter().close(true);
+ writer.getIndexWriter().close();
} catch (AlreadyClosedException e) {
// Ignore.
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/documentation/QueryDocumentationExecutor.java b/gerrit-server/src/main/java/com/google/gerrit/server/documentation/QueryDocumentationExecutor.java
index b734007..188e95b 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/documentation/QueryDocumentationExecutor.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/documentation/QueryDocumentationExecutor.java
@@ -31,7 +31,6 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Version;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,8 +45,6 @@
private static final Logger log =
LoggerFactory.getLogger(QueryDocumentationExecutor.class);
- private static final Version LUCENE_VERSION = Version.LUCENE_48;
-
private IndexSearcher searcher;
private QueryParser parser;
@@ -68,8 +65,7 @@
}
IndexReader reader = DirectoryReader.open(dir);
searcher = new IndexSearcher(reader);
- StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);
- parser = new QueryParser(LUCENE_VERSION, Constants.DOC_FIELD, analyzer);
+ parser = new QueryParser(Constants.DOC_FIELD, new StandardAnalyzer());
} catch (IOException e) {
log.error("Cannot initialize documentation full text index", e);
searcher = null;
diff --git a/gerrit-solr/src/main/java/com/google/gerrit/solr/SolrChangeIndex.java b/gerrit-solr/src/main/java/com/google/gerrit/solr/SolrChangeIndex.java
index 96ba032..9e9f103 100644
--- a/gerrit-solr/src/main/java/com/google/gerrit/solr/SolrChangeIndex.java
+++ b/gerrit-solr/src/main/java/com/google/gerrit/solr/SolrChangeIndex.java
@@ -50,7 +50,6 @@
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.analysis.util.CharArraySet;
import org.apache.lucene.search.Query;
-import org.apache.lucene.util.Version;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrQuery.SortClause;
import org.apache.solr.client.solrj.SolrServer;
@@ -108,13 +107,8 @@
throw new IllegalStateException("index.url must be supplied");
}
- // Version is only used to determine the list of stop words used by the
- // analyzer, so use the latest version rather than trying to match the Solr
- // server version.
- @SuppressWarnings("deprecation")
- Version v = Version.LUCENE_CURRENT;
queryBuilder = new QueryBuilder(
- schema, new StandardAnalyzer(v, CharArraySet.EMPTY_SET));
+ schema, new StandardAnalyzer(CharArraySet.EMPTY_SET));
base = Strings.nullToEmpty(base);
openIndex = new CloudSolrServer(url);
diff --git a/lib/asciidoctor/java/DocIndexer.java b/lib/asciidoctor/java/DocIndexer.java
index 96f3eb5..4736b0b 100644
--- a/lib/asciidoctor/java/DocIndexer.java
+++ b/lib/asciidoctor/java/DocIndexer.java
@@ -51,7 +51,7 @@
import java.util.zip.ZipOutputStream;
public class DocIndexer {
- private static final Version LUCENE_VERSION = Version.LUCENE_48;
+ private static final Version LUCENE_VERSION = Version.LUCENE_4_10_0;
private static final Pattern SECTION_HEADER = Pattern.compile("^=+ (.*)");
@Option(name = "-o", usage = "output JAR file")
@@ -99,7 +99,7 @@
RAMDirectory directory = new RAMDirectory();
IndexWriterConfig config = new IndexWriterConfig(
LUCENE_VERSION,
- new StandardAnalyzer(LUCENE_VERSION, CharArraySet.EMPTY_SET));
+ new StandardAnalyzer(CharArraySet.EMPTY_SET));
config.setOpenMode(OpenMode.CREATE);
IndexWriter iwriter = new IndexWriter(directory, config);
for (String inputFile : inputFiles) {