FTSearchSorted (NotesView - JavaScript)

ビュー内のすべての文書の全文検索を実行してビューをフィルタし、全文照会に一致する文書のみをソートされた順序で示すようにします。

定義場所

NotesView

構文

FTSearchSorted(query:string) : int

FTSearchSorted(query:string, maxdocs:int) : int

FTSearchSorted(query:string, maxdocs:int, column:string) : int

FTSearchSorted(query:string, maxdocs:int, column:string, ascending:boolean, exact:boolean, variants:boolean, fuzzy:boolean) : int

FTSearchSorted(query:string, maxdocs:int, column:int) : int

FTSearchSorted(query:string, maxdocs:int, column:int, ascending:boolean, exact:boolean, variants:boolean, fuzzy:boolean) : int

FTSearchSorted(query:java.util.Vector) : int

FTSearchSorted(query:java.util.Vector, maxdocs:int) : int

FTSearchSorted(query:java.util.Vector, maxdocs:int, column:string) : int

FTSearchSorted(query:java.util.Vector, maxdocs:int, column:string, ascending:boolean, exact:boolean, variants:boolean, fuzzy:boolean) : int

FTSearchSorted(query:java.util.Vector, maxdocs:int, column:int) : int

FTSearchSorted(query:java.util.Vector, maxdocs:int, column:int, ascending:boolean, exact:boolean, variants:boolean, fuzzy:boolean) : int

パラメータ 説明
query フルテキストの照会、または複数照会の共通部分。照会の構文については、以下を参照してください。
maxdocs 検索で返される文書の最大数。 照会に一致するすべての文書を取得する場合は、0 を指定します。デフォルトは 0 です。
column ソートする列の名前または 0 ベースの索引。 NotesView.VIEW_FTSS_RELEVANCE_ORDER (512) と指定すると、大文字小文字の厳密な識別、活用形、あいまい検索のための拡張フラグの使用が有効になり、関連度の順に結果が返されます。
ascending true の場合、列のデータを昇順にソートし、false の場合、降順にソートします。デフォルトは true です。 NotesView.VIEW_FTSS_RELEVANCE_ORDER が有効な場合は無視されます。

列を昇順または降順にソートできるかどうかは、列のプロパティの [ソート] タブの [列のヘッダーをクリック時にソート] によって決まります。該当するオプションは、[昇順]、[降順]、[両方] です。サポートされない方向に列をソートしようとすると、例外がスローされます。

exact true の場合、大文字小文字の厳密な識別を検索に適用します。デフォルトは false。
variants true の場合、検索結果に単語の活用形を返します。デフォルトは false。
fuzzy true の場合、検索結果につづりが異なる語句を返します。デフォルトは false。
戻り値 説明
int 検索後のビュー内の文書数。 これらの文書はすべて照会に一致します。

使用法

このメソッドを呼び出した後、 通常の NotesView メソッドを使用して、ビュー内の文書のサブセットである結果をナビゲートできます。データベースの全文索引が作成されていない場合、そのサブセットの文書の順序は元のビュー内の順序と同じになります。 ただし、データベースの全文索引が作成されている場合、そのサブセットの文書は降順の関連性でソートされます。 メソッド getFirstDocument はサブセット内の最初の文書を返し、 getLastDocument は最後の文書を返します。

全文検索のフィルタをクリアするには、clear メソッドを使用します。 クリアすると、各 NotesView メソッドで、ビュー内のすべての文書をナビゲートできます。

データベースが全文索引付きでない場合、このメソッドは有効ですが、効率は低下します。索引をテストするには、isFTIndexed を使用します。 ローカルデータベース上に索引を作成するには、updateFTIndex を使用します。

照会構文

語または句を検索するには、その語または句をそのまま入力します。ただし、検索キーワードを引用符で囲む必要があります。リテラル内の引用符は必ずエスケープしてください。

ワイルドカードや演算子などの構文も使用できます。詳細な構文規則については、『Notes® ヘルプ』を参照してください。 Domino® Designer Eclipse のヘルプシステムまたはインフォメーションセンター (http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp など) で「照会構文」について検索してください (どちらも IBM Notes から利用できます)。

次のボタンは、検索され、指定した列に基づいてソートされたビューの文書の値を表示します。
if (database.isFTIndexed()) {
	database.updateFTIndex(false)
} else {
	database.createFTIndex(0, true)
}
requestScope.status = "";
var v:NotesView = database.getView("main");
if (requestScope.query1 == null) return;
if (v.FTSearchSorted(requestScope.query1, 0, "year") == 0) return;
var doc:NotesDocument = v.getFirstDocument();
while (doc != null) {
	requestScope.status += "¥n" + 
		doc.getItemValueString("model") + " " +
		doc.getItemValueString("color") + " " +
		doc.getItemValueString("year");
	var tmpdoc = v.getNextDocument(doc);
	doc.recycle();
	doc = tmpdoc;
}
次のボタンは、検索され、関連度に基づいてソートされたビューの文書の値を表示します。
if (database.isFTIndexed()) {
	database.updateFTIndex(false)
} else {
	database.createFTIndex(0, true)
}
requestScope.status = "";
var v:NotesView = database.getView("main");
if (requestScope.query1 == null) return;
if (v.FTSearchSorted(requestScope.query1, 0, NotesView.VIEW_FTSS_RELEVANCE_ORDER) == 0) return;
var doc:NotesDocument = v.getFirstDocument();
while (doc != null) {
	requestScope.status += "¥n" + 
		doc.getItemValueString("model") + " " +
		doc.getItemValueString("color") + " " +
		doc.getItemValueString("year");
	var tmpdoc = v.getNextDocument(doc);
	doc.recycle();
	doc = tmpdoc;
}
次のボタンは、2 つの照会を使用して検索され、最初の列に基づいてソートされたビューの文書の値を表示します。
if (database.isFTIndexed()) {
	database.updateFTIndex(false)
} else {
	database.createFTIndex(0, true)
}
requestScope.status = "";
var v:NotesView = database.getView("main");
if (requestScope.query1 == null) return;
if (requestScope.query2 == null) return;
var query = new java.util.Vector();
query.add(requestScope.query1);
query.add(requestScope.query2);
if (v.FTSearchSorted(query, 0, 0) == 0) return;
var doc:NotesDocument = v.getFirstDocument();
while (doc != null) {
	requestScope.status += "¥n" + 
		doc.getItemValueString("model") + " " +
		doc.getItemValueString("color") + " " +
		doc.getItemValueString("year");
	var tmpdoc = v.getNextDocument(doc);
	doc.recycle();
	doc = tmpdoc;
}
次のボタンは、活用形とあいまい検索を許容して検索され、2 番目の列に基づいて降順にソートされたビューの文書の値を表示します。検索結果は 4 件に制限されています。
if (database.isFTIndexed()) {
	database.updateFTIndex(false)
} else {
	database.createFTIndex(0, true)
}
requestScope.status = "";
var v:NotesView = database.getView("main");
if (requestScope.query1 == null) return;
if (v.FTSearchSorted(requestScope.query1, 4, 1, false, false, true, true) == 0) return;
var doc:NotesDocument = v.getFirstDocument();
while (doc != null) {
	requestScope.status += "¥n" + 
		doc.getItemValueString("model") + " " +
		doc.getItemValueString("color") + " " +
		doc.getItemValueString("year");
	var tmpdoc = v.getNextDocument(doc);
	doc.recycle();
	doc = tmpdoc;
}