01: package org.apache.lucene.benchmark.byTask.feeds;
02:
03: /**
04: * Licensed to the Apache Software Foundation (ASF) under one or more
05: * contributor license agreements. See the NOTICE file distributed with
06: * this work for additional information regarding copyright ownership.
07: * The ASF licenses this file to You under the Apache License, Version 2.0
08: * (the "License"); you may not use this file except in compliance with
09: * the License. You may obtain a copy of the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS,
15: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: * See the License for the specific language governing permissions and
17: * limitations under the License.
18: */
19:
20: import org.apache.lucene.document.Document;
21: import org.apache.lucene.benchmark.byTask.utils.Config;
22:
23: /**
24: * Create documents for the test.
25: * <br>Each call to makeDocument would create the next document.
26: * When input is exhausted, the DocMaker iterates over the input again,
27: * providing a source for unlimited number of documents,
28: * though not all of them are unique.
29: */
30: public interface DocMaker {
31:
32: /**
33: * Create the next document, of the given size by input bytes.
34: * If the implementation does not support control over size, an exception is thrown.
35: * @param size size of document, or 0 if there is no size requirement.
36: * @exception if cannot make the document, or if size>0 was specified but this feature is not supported.
37: */
38: public Document makeDocument(int size) throws Exception;
39:
40: /** Create the next document. */
41: public Document makeDocument() throws Exception;
42:
43: /** Set the properties */
44: public void setConfig(Config config);
45:
46: /** Reset inputs so that the test run would behave, input wise, as if it just started. */
47: public void resetInputs();
48:
49: /** Return how many real unique texts are available, 0 if not applicable. */
50: public int numUniqueTexts();
51:
52: /** Return total bytes of all available unique texts, 0 if not applicable */
53: public long numUniqueBytes();
54:
55: /** Return number of docs made since last reset. */
56: public int getCount();
57:
58: /** Return total byte size of docs made since last reset. */
59: public long getByteCount();
60:
61: /** Print some statistics on docs available/added/etc. */
62: public void printDocStatistics();
63:
64: /** Set the html parser to use, when appropriate */
65: public void setHTMLParser(HTMLParser htmlParser);
66:
67: /** Returns the htmlParser. */
68: public HTMLParser getHtmlParser();
69:
70: }
|