NEAR2
Use the NEAR2 operator to perform position-based scoring and length normalization to help improve relevancy.
The NEAR2 operator divides a document into segments based on the given query. Then, it classifies each segment based on the primary features and scores them based on the secondary features. The primary features that are used are as follows:
-
Using EXCHANGE_SHADOW_INDEX with Nonpartitioned Indexes:
For nonpartitioned indexes, this procedure will swap both metadata and index data, and will process the online pending queue.
Queries will return column not indexed errors when swapping metadata and index data, but queries are processed normally when processing online pending queue. The period of errors being raised should be short.
If you specify
POPULATEwhen you create the shadow index, and if many DML operations have been issued since the creation of the shadow index, then there could be a large pending queue. However, if you use incremental recreate, that is, specifyNOPOPULATEwhen you create the shadow index, and you then populate the pending queue and sync, then the online pending queue is always empty no matter how many DML operations have occurred sinceCREATE_SHADOW_INDEXwas issued.When this procedure is running, DML will first fail with an error about index being in in-progress status. After that DML could be blocked if there are rows in online pending queue that need to be reapplied.
NOTE_PLACEHOLDER_0
-
Using EXCHANGE_SHADOW_INDEX with Partitioned Indexes:
For partitions that are recreated with
NOSWAP: when the index is partitioned, and if partition_name is a valid index partition, then this procedure will swap the index partition data and the index partition metadata, and will process the online pending queue for this partition.This procedure swaps only one partition at a time. When you run this procedure on partitions that are recreated with
NOSWAP:-
Queries that span multiple partitions will not return consistent results across all partitions.
-
Queries on the partition that is being swapped will return errors.
-
Queries on partitions that are already swapped will be based on the new index.
-
Queries on the partitions that haven’t been swapped will be based on the old index.
If the partition_name is NULL, then this procedure will swap the index metadata. Run this procedure as the last step when recreating a local partitioned index online.
-
-
Sync Behavior:
After running
EXCHANGE_SHADOW_INDEX, you must call theSYNC_INDEXoperation to synchronize any DML that occurs during the build of the shadow index. If you have specifiedSYNC(ON COMMIT)orSYNC(EVERY), then the sync occurs automatically. However, if you have specifiedSYNC(MANUAL), then you must manually invokeSYNC_INDEX.
The secondary features are as follows:
-
Excess Span
-
Start Position
-
Longest Partial Phrase
Syntax
NEAR2((word1, word2,...,wordn),max_span, phrase_weight, partial_phrase_weight, ordered_near_weight, unordered_near_weight, and_weight)
All or none of the weights must be provided. When the weights are provided, the NEAR2 operator works in the weighted-average mode. The weights are integers between 0 and 10.
word1-n
Specify the terms in the query separated by commas. The query terms can be single words or phrases and can use other query operators (see “NEAR with Other Operators”). Only the word list is mandatory.
max_span
Optionally, specify the size of the biggest clump. The default is 50. Oracle Text returns an error if you specify a number greater than 50.
A clump is the smallest group of words in which all query terms occur. All clumps begin and end with a query term.
For near queries with two terms, max_span is the maximum distance allowed between the two terms. For example, to query on dog and cat where dog is within 6 words of cat, enter the following query:
'near((dog, cat), 6)'
phrase_weight
Determine the weight of the phrase primary feature when in weighted-average mode. This is a qualitative weight, which is mapped to an internal weight.
partial_phrase_weight
Determine the weight of the partial phrase primary feature when in weighted-average mode. This is a qualitative weight.
ordered_near_weight
Determine the weight of the ordered near primary feature when in weighted-average mode. This is a qualitative weight.
unordered_near_weight
Determine the weight of the unordered near primary feature when in weighted-average mode. This is a qualitative weight.
and_weight
Determine the weight of the AND primary feature when in weighted average mode. This is a qualitative weight.
Related Topics