NDATA
Use the NDATA operator to find matches that are spelled in a similar way or where rearranging the terms of the specified phrase is useful.
It is helpful for finding more accurate results when there are frequent misspellings (or inaccurate orderings) of name data in the document set. This operator can be used only on defined NDATA sections. The NDATA syntax enables you to rank the result set so that documents that contain words with high orthographic similarity are scored higher than documents with lower similarity.
Normalization
A lexer does not process NDATA query phrases. Users can, however, set base letter and alternate spelling attributes for a particular section group containing NDATA sections. Query case is normalized and non-character data (except for white space) is removed (for example, numerical or punctuation).
Syntax
ndata(sectionname, phrase [,order][,proximity][,threshold])
| Parameter Name | Default Value | Parameter Description |
| — | — | — |
sectionname |
Specify the name of a defined NDATA sections to query (that is, section_name) |
phrase |
Specify the phrase for the name data query. The phrase parameter can be a single word or a phrase, or a string of words in free text format. The score returned is a relevant score. Oracle Text ignores any query operators that are included in The phrase should be a minimum of two characters in length and should not exceed 4000 characters in length. |
order |
NOORDER |
Specify whether individual tokens (terms) in a query should be matched in-order or in any order. The order parameter provides a primary filter for matching candidate documents.
|
proximity |
NOPROXIMITY |
Specify whether the proximity of terms should influence the similarity score of candidate matches. That is, if the proximity parameter is enabled, non-matching additional terms between matching terms reduces the similarity score of candidate matches.
|
threshold |
20 |
Starting with Oracle Database 12c Release 2 (12.2), you can provide a threshold value as part of the NDATA operator. Specify a threshold value for percentage of matching grams. The section values containing low percentage of matching grams are ignored. If the threshold value is 20, sections with less than 20% of matching grams are ignored. If this value is lowered, fewer sections are ignored and this leads to a better recall. This threshold value promotes recall over precision as the value is lowered. For example: NDATA(author, LAST First, x, proximity, 10) |
Examples for NDATA Operator
An NDATA query on an indexed surname section name that matches terms in the query phrase in any order without influencing the similarity score by the proximity of the jones and smith terms has the form:
SELECT entryid, SCORE(1) FROM people WHERE
CONTAINS(idx_column, 'NDATA(surname, jones smith)',1)>0;
An NDATA query on an indexed surname section name that matches terms in the query phrase in any order and in which similarity scores are influenced by the proximity of the jones and smith terms has the form:
SELECT entryid, SCORE(1) FROM people WHERE
CONTAINS(idx_column, 'NDATA(surname, jones smith,,proximity)',1)>0;
An NDATA query on an indexed surname section name that matches terms in the query phrase in-order without influencing the similarity score by the proximity of the jones and smith terms has the form:
SELECT entryid, SCORE(1) FROM people WHERE
CONTAINS(idx_column, 'NDATA(surname, jones smith, order)',1)>0;
An NDATA query on an indexed surname section name that matches terms in the query phrase in-order and in which similarity scores are influenced by the proximity of the jones and smith terms has the form:
SELECT entryid, SCORE(1) FROM people WHERE
CONTAINS(idx_column, 'NDATA(surname, jones smith, order, proximity)',1)>0;
Notes
The NDATA query operator does not provide offset information. As such, it cannot be used as a child of WITHIN, NEAR(;), or EQUIV(=), and NDATA sections are ignored by CTX_DOC.HIGHLIGHT, CTX_DOC.SNIPPET, and CTX_DOC.MARKUP.
The NDATA operator is not supported in the CTXCAT grammar. You can use it with other operators, including OR and query templates. You cannot use other query operators inside the NDATA operator.
A use case of the NDATA operator may involve finding a particular entry based on an approximate spelling of a person’s full-name and an estimated date-of-birth. Supposing the entries’ date-of-births are stored as an SDATA section, user-defined scoring’s alternate scoring template can be used to combine the scores of the full-name’s NDATA section data and the date-of-birth’s SDATA section data.
The name john smith is queried for the section specified by the fullname section_name. Altering the NDATA operator’s score based on the closeness of the SDATA section’s date-of-birth to the date 08-NOV-2012 modifies the ranking of matching documents as follows:
<query>
<textquery grammar="CONTEXT" lang="english">
NDATA(fullname, john smith)
</textquery>
<score algorithm="COUNT" normalization_expr =
"doc_score-(DATE(8-NOV-2012)-sdata:dob)"/>
</query>
Restrictions
The NDATA query operator does not work with CTX_DOC Package procedures. Attempting to use NDATA with CTX_DOC procedures will return an error stating that this is not supported.