Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds the type
tsvectorof text search, astsvector.c,tsvector_parser.candtsvector_op.chave it. The functions that need a text search configuration, such asto_tsvector, are not in this change.Changes
rupg-typeshas the newLexemeandValue::TsVector, a list of lexemes in order. Each position keeps the weight in the two high bits, asWordEntryPosdoes.tsvector_parsefollows the states ofgettoken_tsvector: quotes, escapes, positions, weights and the errors42601and54000. The input sorts the lexemes, merges equal lexemes and keeps up to 256 positions for each lexeme.tsvector_deparse,tsvector_sendandtsvector_recvgive the text and binary forms. The receive function has the checks oftsvectorrecv.Recv::cstringreads a string up to a zero byte, aspq_getmsgstringdoes.tsvector_cmpgives the order ofsilly_cmp_tsvector: the size, the number of lexemes, then the lexemes, the positions and the weights.rupg-funchaslength,strip,setweight,ts_delete,tsvector_to_array,array_to_tsvector,ts_filter,unnest, the operator||,tsvector_cmpand the comparison operators.tsvectorin a stored expression keeps the bytes of its binary form.Known differences
memcmpfromtsvector_cmpwhen two lexemes are different. That value can change with the C library. Here it is the difference of the first two bytes that are not equal.Tests
tsvectoris the output of PostgreSQL 19 for the same script in a new database. It has the input and its errors, the output, the order, each function, the limits of the positions and of a lexeme, arrays,GROUP BY,DISTINCT, text and binaryCOPYand a query with parameters.