<s>
Trigram	B-Algorithm
search	I-Algorithm
is	O
a	O
method	O
of	O
searching	B-Application
for	O
text	O
when	O
the	O
exact	O
syntax	B-Application
or	O
spelling	O
of	O
the	O
target	O
object	O
is	O
not	O
precisely	O
known	O
or	O
when	O
queries	O
may	O
be	O
regular	B-Language
expressions	I-Language
.	O
</s>
<s>
trigrams	B-General_Concept
)	O
in	O
the	O
entered	O
search	O
terms	O
,	O
which	O
are	O
generally	O
near	O
matches	O
.	O
</s>
<s>
Two	O
strings	O
with	O
many	O
shared	O
trigrams	B-General_Concept
can	O
be	O
expected	O
to	O
be	O
very	O
similar	O
.	O
</s>
<s>
Trigrams	B-General_Concept
also	O
allow	O
for	O
efficiently	O
creating	O
search	O
engine	O
indexes	O
for	O
searches	O
that	O
are	O
regular	B-Language
expressions	I-Language
or	O
match	O
the	O
text	O
inexactly	O
.	O
</s>
<s>
A	O
threshold	O
for	O
number	O
of	O
trigram	B-General_Concept
matches	O
can	O
be	O
specified	O
as	O
a	O
cutoff	O
point	O
,	O
after	O
which	O
a	O
result	O
is	O
no	O
longer	O
considered	O
a	O
match	O
.	O
</s>
<s>
Using	O
trigrams	B-General_Concept
for	O
accelerating	O
searches	O
is	O
a	O
technique	O
used	O
in	O
some	O
systems	O
for	O
code	B-Application
searching	B-Application
,	O
in	O
situations	O
in	O
which	O
queries	O
that	O
are	O
regular	B-Language
expressions	I-Language
may	O
be	O
useful	O
,	O
in	O
search	O
engines	O
such	O
as	O
Elasticsearch	B-Application
,	O
as	O
well	O
as	O
in	O
databases	O
such	O
as	O
PostgreSQL	B-Application
.	O
</s>
<s>
The	O
trigrams	B-General_Concept
of	O
the	O
string	O
would	O
be	O
"	O
ali	O
"	O
,	O
"	O
lic	O
"	O
,	O
and	O
"	O
ice	O
,	O
"	O
not	O
including	O
spaces	O
.	O
</s>
<s>
Searching	B-Application
for	O
this	O
string	O
in	O
a	O
database	O
with	O
a	O
trigram-based	O
index	O
would	O
involve	O
finding	O
which	O
objects	O
contain	O
as	O
many	O
of	O
the	O
three	O
trigrams	B-General_Concept
as	O
possible	O
.	O
</s>
<s>
As	O
a	O
concrete	O
example	O
of	O
using	O
trigram	B-Algorithm
search	I-Algorithm
to	O
search	O
for	O
a	O
regular	B-Language
expression	I-Language
query	O
,	O
consider	O
searching	B-Application
for	O
the	O
string	O
ab[cd]e,	O
where	O
the	O
brackets	O
denote	O
that	O
the	O
third	O
character	O
in	O
the	O
string	O
being	O
searched	O
for	O
could	O
be	O
c	O
or	O
d	O
.	O
In	O
this	O
situation	O
,	O
one	O
could	O
query	O
the	O
index	O
for	O
objects	O
that	O
have	O
the	O
two	O
trigrams	B-General_Concept
abc	O
and	O
bce	O
or	O
the	O
two	O
trigrams	B-General_Concept
abd	O
and	O
bde	O
.	O
</s>
<s>
Thus	O
,	O
finding	O
this	O
query	O
would	O
involve	O
no	O
string	B-Algorithm
matching	I-Algorithm
,	O
and	O
could	O
just	O
query	O
the	O
index	O
directly	O
,	O
which	O
can	O
be	O
faster	O
in	O
practice	O
.	O
</s>
