Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What data structure to use for indexing data for partial %infix% searching?

Imagine you have a huge cache of data that is to be searched through by 4 ways :

  1. exact match
  2. prefix%
  3. %suffix
  4. %infix%

I'm using Trie for the first 3 types of searching, but I can't figure out how to approach the fourth one other than sequential processing of huge array of elements.

like image 881
lisak Avatar asked Sep 13 '12 17:09

lisak


1 Answers

If your dataset is huge cosider using a search platform like Apache Solr so that you dont end up in a performance mess.

like image 86
basiljames Avatar answered Oct 19 '22 10:10

basiljames