提交 6f56b7de authored 作者: Thomas Mueller's avatar Thomas Mueller

Documentation.

上级 e3c38968
...@@ -19,7 +19,7 @@ Change Log ...@@ -19,7 +19,7 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>New feature INSERT INTO ... DIRECT SELECT, mainly to speed up loading tables <ul><li>New feature INSERT INTO ... DIRECT SELECT, mainly to speed up loading tables
from a CSV file. When using DIRECT, then the results from the query are directly applied from a CSV file. When using DIRECT, then the results from the query are directly applied
in the target table without any intermediate step (without temporary file). in the target table without any intermediate step (without temporary file).
</li><li>Converting binary data to UUID was incorrect when the converting more than 31 bytes. </li><li>Converting binary data to UUID was incorrect when the converting more than 31 bytes.
Now always the first 16 bytes are used. Now always the first 16 bytes are used.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -39,11 +39,11 @@ import org.h2.util.New; ...@@ -39,11 +39,11 @@ import org.h2.util.New;
import org.h2.util.StatementBuilder; import org.h2.util.StatementBuilder;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
//## Java 1.4 end ## //## Java 1.4 end ##
/*## LUCENE2 begin ## //## LUCENE2 begin ##
import org.apache.lucene.index.IndexModifier; import org.apache.lucene.index.IndexModifier;
import org.apache.lucene.search.Hits; import org.apache.lucene.search.Hits;
## LUCENE2 end ##*/ //## LUCENE2 end ##
//## LUCENE3 begin ## /*## LUCENE3 begin ##
import java.io.File; import java.io.File;
import org.apache.lucene.search.ScoreDoc; import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TopDocs; import org.apache.lucene.search.TopDocs;
...@@ -51,7 +51,7 @@ import org.apache.lucene.store.FSDirectory; ...@@ -51,7 +51,7 @@ import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.Directory; import org.apache.lucene.store.Directory;
import org.apache.lucene.util.Version; import org.apache.lucene.util.Version;
import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriter;
//## LUCENE3 end ## ## LUCENE3 end ##*/
/** /**
* This class implements the full text search based on Apache Lucene. * This class implements the full text search based on Apache Lucene.
...@@ -268,13 +268,13 @@ public class FullTextLucene extends FullText { ...@@ -268,13 +268,13 @@ public class FullTextLucene extends FullText {
IndexAccess access = INDEX_ACCESS.get(path); IndexAccess access = INDEX_ACCESS.get(path);
if (access == null) { if (access == null) {
try { try {
/*## LUCENE2 begin ## //## LUCENE2 begin ##
boolean recreate = !IndexReader.indexExists(path); boolean recreate = !IndexReader.indexExists(path);
Analyzer analyzer = new StandardAnalyzer(); Analyzer analyzer = new StandardAnalyzer();
access = new IndexAccess(); access = new IndexAccess();
access.modifier = new IndexModifier(path, analyzer, recreate); access.modifier = new IndexModifier(path, analyzer, recreate);
## LUCENE2 end ##*/ //## LUCENE2 end ##
//## LUCENE3 begin ## /*## LUCENE3 begin ##
File f = new File(path); File f = new File(path);
Directory indexDir = FSDirectory.open(f); Directory indexDir = FSDirectory.open(f);
boolean recreate = !IndexReader.indexExists(indexDir); boolean recreate = !IndexReader.indexExists(indexDir);
...@@ -287,7 +287,7 @@ public class FullTextLucene extends FullText { ...@@ -287,7 +287,7 @@ public class FullTextLucene extends FullText {
access.writer = writer; access.writer = writer;
access.reader = reader; access.reader = reader;
access.searcher = new IndexSearcher(reader); access.searcher = new IndexSearcher(reader);
//## LUCENE3 end ## ## LUCENE3 end ##*/
} catch (IOException e) { } catch (IOException e) {
throw convertException(e); throw convertException(e);
} }
...@@ -361,15 +361,15 @@ public class FullTextLucene extends FullText { ...@@ -361,15 +361,15 @@ public class FullTextLucene extends FullText {
synchronized (INDEX_ACCESS) { synchronized (INDEX_ACCESS) {
try { try {
INDEX_ACCESS.remove(indexPath); INDEX_ACCESS.remove(indexPath);
/*## LUCENE2 begin ## //## LUCENE2 begin ##
access.modifier.flush(); access.modifier.flush();
access.modifier.close(); access.modifier.close();
## LUCENE2 end ##*/ //## LUCENE2 end ##
//## LUCENE3 begin ## /*## LUCENE3 begin ##
access.searcher.close(); access.searcher.close();
access.reader.close(); access.reader.close();
access.writer.close(); access.writer.close();
//## LUCENE3 end ## ## LUCENE3 end ##*/
} catch (Exception e) { } catch (Exception e) {
throw convertException(e); throw convertException(e);
} }
...@@ -397,7 +397,7 @@ public class FullTextLucene extends FullText { ...@@ -397,7 +397,7 @@ public class FullTextLucene extends FullText {
} }
try { try {
IndexAccess access = getIndexAccess(conn); IndexAccess access = getIndexAccess(conn);
/*## LUCENE2 begin ## //## LUCENE2 begin ##
access.modifier.flush(); access.modifier.flush();
String path = getIndexPath(conn); String path = getIndexPath(conn);
IndexReader reader = IndexReader.open(path); IndexReader reader = IndexReader.open(path);
...@@ -413,8 +413,8 @@ public class FullTextLucene extends FullText { ...@@ -413,8 +413,8 @@ public class FullTextLucene extends FullText {
for (int i = 0; i < limit && i + offset < max; i++) { for (int i = 0; i < limit && i + offset < max; i++) {
Document doc = hits.doc(i + offset); Document doc = hits.doc(i + offset);
float score = hits.score(i + offset); float score = hits.score(i + offset);
## LUCENE2 end ##*/ //## LUCENE2 end ##
//## LUCENE3 begin ## /*## LUCENE3 begin ##
// take a reference as the searcher may change // take a reference as the searcher may change
Searcher searcher = access.searcher; Searcher searcher = access.searcher;
// reuse the same analyzer; it's thread-safe; // reuse the same analyzer; it's thread-safe;
...@@ -438,7 +438,7 @@ public class FullTextLucene extends FullText { ...@@ -438,7 +438,7 @@ public class FullTextLucene extends FullText {
ScoreDoc sd = docs.scoreDocs[i + offset]; ScoreDoc sd = docs.scoreDocs[i + offset];
Document doc = searcher.doc(sd.doc); Document doc = searcher.doc(sd.doc);
float score = sd.score; float score = sd.score;
//## LUCENE3 end ## ## LUCENE3 end ##*/
String q = doc.get(LUCENE_FIELD_QUERY); String q = doc.get(LUCENE_FIELD_QUERY);
if (data) { if (data) {
int idx = q.indexOf(" WHERE "); int idx = q.indexOf(" WHERE ");
...@@ -461,10 +461,10 @@ public class FullTextLucene extends FullText { ...@@ -461,10 +461,10 @@ public class FullTextLucene extends FullText {
result.addRow(q, score); result.addRow(q, score);
} }
} }
/*## LUCENE2 begin ## //## LUCENE2 begin ##
// TODO keep it open if possible // TODO keep it open if possible
reader.close(); reader.close();
## LUCENE2 end ##*/ //## LUCENE2 end ##
} catch (Exception e) { } catch (Exception e) {
throw convertException(e); throw convertException(e);
} }
...@@ -607,7 +607,7 @@ public class FullTextLucene extends FullText { ...@@ -607,7 +607,7 @@ public class FullTextLucene extends FullText {
* @param row the row * @param row the row
*/ */
protected void insert(Object[] row) throws SQLException { protected void insert(Object[] row) throws SQLException {
/*## LUCENE2 begin ## //## LUCENE2 begin ##
String query = getQuery(row); String query = getQuery(row);
Document doc = new Document(); Document doc = new Document();
doc.add(new Field(LUCENE_FIELD_QUERY, query, doc.add(new Field(LUCENE_FIELD_QUERY, query,
...@@ -639,8 +639,8 @@ public class FullTextLucene extends FullText { ...@@ -639,8 +639,8 @@ public class FullTextLucene extends FullText {
} catch (IOException e) { } catch (IOException e) {
throw convertException(e); throw convertException(e);
} }
## LUCENE2 end ##*/ //## LUCENE2 end ##
//## LUCENE3 begin ## /*## LUCENE3 begin ##
String query = getQuery(row); String query = getQuery(row);
Document doc = new Document(); Document doc = new Document();
doc.add(new Field(LUCENE_FIELD_QUERY, query, doc.add(new Field(LUCENE_FIELD_QUERY, query,
...@@ -680,7 +680,7 @@ public class FullTextLucene extends FullText { ...@@ -680,7 +680,7 @@ public class FullTextLucene extends FullText {
} catch (IOException e) { } catch (IOException e) {
throw convertException(e); throw convertException(e);
} }
//## LUCENE3 end ## ## LUCENE3 end ##*/
} }
/** /**
...@@ -692,12 +692,12 @@ public class FullTextLucene extends FullText { ...@@ -692,12 +692,12 @@ public class FullTextLucene extends FullText {
String query = getQuery(row); String query = getQuery(row);
try { try {
Term term = new Term(LUCENE_FIELD_QUERY, query); Term term = new Term(LUCENE_FIELD_QUERY, query);
/*## LUCENE2 begin ## //## LUCENE2 begin ##
indexAccess.modifier.deleteDocuments(term); indexAccess.modifier.deleteDocuments(term);
## LUCENE2 end ##*/ //## LUCENE2 end ##
//## LUCENE3 begin ## /*## LUCENE3 begin ##
indexAccess.writer.deleteDocuments(term); indexAccess.writer.deleteDocuments(term);
//## LUCENE3 end ## ## LUCENE3 end ##*/
} catch (IOException e) { } catch (IOException e) {
throw convertException(e); throw convertException(e);
} }
...@@ -731,30 +731,30 @@ public class FullTextLucene extends FullText { ...@@ -731,30 +731,30 @@ public class FullTextLucene extends FullText {
/** /**
* The index modified. * The index modified.
*/ */
/*## LUCENE2 begin ## //## LUCENE2 begin ##
IndexModifier modifier; IndexModifier modifier;
## LUCENE2 end ##*/ //## LUCENE2 end ##
/** /**
* The index writer. * The index writer.
*/ */
//## LUCENE3 begin ## /*## LUCENE3 begin ##
IndexWriter writer; IndexWriter writer;
//## LUCENE3 end ## ## LUCENE3 end ##*/
/** /**
* The index reader. * The index reader.
*/ */
//## LUCENE3 begin ## /*## LUCENE3 begin ##
IndexReader reader; IndexReader reader;
//## LUCENE3 end ## ## LUCENE3 end ##*/
/** /**
* The index searcher. * The index searcher.
*/ */
//## LUCENE3 begin ## /*## LUCENE3 begin ##
Searcher searcher; Searcher searcher;
//## LUCENE3 end ## ## LUCENE3 end ##*/
} }
} }
...@@ -14,7 +14,7 @@ FROM tableExpression [,...] [ WHERE expression ] ...@@ -14,7 +14,7 @@ FROM tableExpression [,...] [ WHERE expression ]
Selects data from a table or multiple tables." Selects data from a table or multiple tables."
"Commands (DML)","INSERT"," "Commands (DML)","INSERT","
INSERT INTO tableName [ ( columnName [,...] ) ] INSERT INTO tableName [ ( columnName [,...] ) ]
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | select } { VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | [ DIRECT ] [ SORTED ] select }
"," ","
Inserts a new row / new rows into a table." Inserts a new row / new rows into a table."
"Commands (DML)","UPDATE"," "Commands (DML)","UPDATE","
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论